摘要:
c语言 8-1 1、 #include <stdio.h> #define diff(x, y) ((x) - (y)) int main(void) { int a, b; puts("please input two integers."); printf("a = "); scanf("%d" 阅读全文
posted @ 2021-05-24 18:09
小鲨鱼2018
阅读(386)
评论(0)
推荐(0)
摘要:
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
阅读(231)
评论(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
阅读(117)
评论(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
阅读(564)
评论(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
阅读(64)
评论(0)
推荐(0)