上一页 1 ··· 276 277 278 279 280 281 282 283 284 ··· 367 下一页
摘要: c语言中函数、函数式宏例子 返回一个数的平方。 1、函数 #include <stdio.h> int sqr_int(int x) { return x * x; } double sqr_double(double x) { return x * x; } int main(void) { in 阅读全文
posted @ 2021-05-24 13:07 小鲨鱼2018 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j, ch; int cnt[10] = {}; while((ch = getchar()) != EOF) { if(ch > '0' && ch < '9') { cnt[ch - '0']++; } 阅读全文
posted @ 2021-05-24 12:20 小鲨鱼2018 阅读(96) 评论(0) 推荐(0) 编辑
摘要: c语言中数字字符计数 1、 #include <stdio.h> int main(void) { int i, ch; int cnt[10] = {}; while((ch = getchar()) != EOF) { switch(ch) { case '0': cnt[0]++; break 阅读全文
posted @ 2021-05-24 10:54 小鲨鱼2018 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int ch; int rows = 0; while((ch = getchar()) != EOF) { switch(ch) { case '\n': rows++; break; } } printf("numbe 阅读全文
posted @ 2021-05-24 09:10 小鲨鱼2018 阅读(57) 评论(0) 推荐(0) 编辑
摘要: c语言中数字字符计数。 1、 #include <stdio.h> int main(void) { int i, ch; int cnt[10] = {}; while((ch = getchar()) != EOF) { switch(ch) { case '0': cnt[0]++; brea 阅读全文
posted @ 2021-05-23 23:09 小鲨鱼2018 阅读(431) 评论(0) 推荐(0) 编辑
摘要: c语言中将输入的字符直接输出 getchar函数 和EOF getchar函数用于读取字符并返回,(getchar和putchar都只处理一个字符); EOF是对象式宏,为一个负值。 1、 #include <stdio.h> int main(void) { int ch; while((ch = 阅读全文
posted @ 2021-05-23 22:33 小鲨鱼2018 阅读(1156) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int ch; int time[1] = {}; while((ch = getchar()) != EOF) { switch(ch) { case '\n': time[0]++; break; } } printf 阅读全文
posted @ 2021-05-23 11:31 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int gcd(int x, int y) { int max, min, tmp; if(x != y) { max = x > y ? x : y; min = x > y ? y : x; tmp = max % min; if(tmp != 0) 阅读全文
posted @ 2021-05-22 23:42 小鲨鱼2018 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int fac(int x) { if(x > 0) return x * fac(x - 1); else return 1; } int main(void) { int a, b; puts("please input two integers.") 阅读全文
posted @ 2021-05-22 23:22 小鲨鱼2018 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int fac(int x) { int i, fac = 1; if(x > 0) { for(i = x; i > 0; i--) fac *= i; } else fac = 1; return fac; } int main(void) { int 阅读全文
posted @ 2021-05-22 19:19 小鲨鱼2018 阅读(77) 评论(0) 推荐(0) 编辑
上一页 1 ··· 276 277 278 279 280 281 282 283 284 ··· 367 下一页