![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言:基础题编程
weixin_43665107
这个作者很懒,什么都没留下…
展开
-
C语言:基础题目(二)
题目1:一个数如果恰好等于它的因子之和,这个数被成为”完数”,例如:6=1+2+3.请编程找出1000以内的完数#include <stdio.h>int main(){ int i,j; for(i=2;i<1000;i++) { int sum=0; for(j=1;j<i/2+1;j++) { if(i%j ==原创 2018-11-25 21:39:56 · 433 阅读 · 0 评论 -
贪吃蛇改版
父进程工作: 检测方向键子进程工作:负责游戏运行main.c#include <stdio.h>#include <unistd.h>#include <string.h>#include "snake.h"#define SIZE 1024int kfd = 0;struct termios cooked, raw;extern ch...原创 2018-12-26 21:31:57 · 193 阅读 · 0 评论 -
C语言:多项式计算器
main.c#include <stdio.h>#include "stack.h"#include <string.h>BOOL Ope_judge(Stack *s_ope,int ope)//判断操作符是否入栈{ if(Empty(s_ope)) return TRUE; int top = GetTop(s_ope); switch(...原创 2018-12-12 22:06:43 · 1490 阅读 · 0 评论 -
C语言:基础题目(四)
题目1:编程实现查找两个字符串的最大公共子串示例:“aocdfe"和"pmcdfa"最大公共子串为"cdf”方法一:#include <stdio.h>#include <string.h>int main(){ char *str1 = "aocdfe"; char *str2 = "aadapmcdfa"; int longest = 0; /原创 2018-11-27 21:15:17 · 177 阅读 · 0 评论 -
C语言:基础题目(六)
用函数写1.编程求两个复数的和结构体函数返回值是结构体参数 两个结构体 #include <stdio.h> #include <stdlib.h> typedef struct _complex { int Re; int Im;}complex;complex create(int a,int b){ comp...原创 2018-12-02 22:09:22 · 881 阅读 · 0 评论 -
C语言:基础题目(三)
题目1:有n个人围成一圈,顺序排号,从第一个开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位.提示:用数组完成 #include <stdio.h> #define N 5 int main2() { int num[N] = {0}; int count = N;//计目前还有几个人 ...原创 2018-11-26 21:20:06 · 158 阅读 · 0 评论 -
C语言:贪吃蛇
#include <stdio.h>#include <stdlib.h>#include <time.h>#include <signal.h>#include <termios.h>#include <stdio.h>#include <stdlib.h>#include <stri原创 2018-11-29 22:15:07 · 142 阅读 · 0 评论 -
C语言:基础题目(五)
1.通讯录#include <stdio.h> struct date { int id; char name[10];};int main(){ int i; int m; int com; int length=0; struct date a[10]; while(1) { printf("1、增加联系人:\...原创 2018-11-28 23:29:48 · 222 阅读 · 0 评论 -
基础题目(一)
题目1:输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数。#include &lt;stdio.h&gt;int main(){ int n; scanf("%d",&amp;n); int i; int count=0; for(i=0;i&lt;=n;i++) { int tmp=i;原创 2018-11-24 23:13:57 · 193 阅读 · 0 评论 -
C语言:加密基础题
将一个不定长的字符串转换为一个定长的数字输入:字符串输出:16位数字转换格式:将字符串分成n组,每组16个字符将n组字符串相应位置的字符相加,如果值不是个位数,则各个位再进行相加直到为个位数为止,最终得出的16个数字即要求输出的数字#include <stdio.h>#include <string.h> int main() { ...原创 2018-12-10 21:44:16 · 724 阅读 · 0 评论