上一页 1 ··· 316 317 318 319 320 321 322 323 324 ··· 407 下一页
摘要: 1、 #include <stdio.h> enum a {x, y, z}; int main(void) { printf("x = %d\n", x); printf("y = %d\n", y); printf("z = %d\n", z); return 0; } 2、 #include 阅读全文
posted @ 2021-05-25 09:39 小鲨鱼2018 阅读(62) 评论(0) 推荐(0)
摘要: 1、从尾至头,升序 #include <stdio.h> #define NUMBER 5 void sort_1(int x[], int n) { int i, j; for(i = 0; i < n - 1; i++) { for(j = n - 1; j > i; j--) { if(x[j 阅读全文
posted @ 2021-05-25 08:44 小鲨鱼2018 阅读(2571) 评论(0) 推荐(0)
摘要: 1、 #include <stdio.h> #define swap(type, x, y) type tmp = x; x = y; y = tmp; int main(void) { int x = 10, y = 5; swap(int, x, y); printf("x = %d\n", x 阅读全文
posted @ 2021-05-24 18:39 小鲨鱼2018 阅读(60) 评论(0) 推荐(0)
摘要: 1、 #include <stdio.h> #define max(x, y) ((x > y) ? x : y) int main(void) { int a, b, c, d; puts("please input four integers."); printf("a = "); scanf( 阅读全文
posted @ 2021-05-24 18:29 小鲨鱼2018 阅读(90) 评论(0) 推荐(0)
摘要: 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 阅读(391) 评论(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 阅读(233) 评论(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 阅读(119) 评论(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 阅读(568) 评论(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 阅读(66) 评论(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 阅读(477) 评论(0) 推荐(0)
上一页 1 ··· 316 317 318 319 320 321 322 323 324 ··· 407 下一页