1 2 3 4

2020年12月9日

C语言之sizeof函数求数组长度

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,256,12,621,62,3462,6,89999,87}; int g=sizeof(add) / sizeof(add[0]); printf("add数组的长度 阅读全文

posted @ 2020-12-09 21:38 三日坊主i 阅读(859) 评论(0) 推荐(0)

C语言数组的最值查找

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,256,12,621,62,3462,6,89999,87}; int Max=add[0]; int Mini; for (int x = 0; x < g; x++ 阅读全文

posted @ 2020-12-09 21:37 三日坊主i 阅读(213) 评论(0) 推荐(0)

C语言之数组的静态创建与遍历

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,2,51,6,16,1 }; // 静态创建1 int arr[2]; // 静态创建2 arr[0] = 12; arr[1] = 25; arr[2] = 100; 阅读全文

posted @ 2020-12-09 16:05 三日坊主i 阅读(279) 评论(0) 推荐(0)

C语言之随机数

摘要: #include <stdio.h>#include <stdlib.h>#include <time.h> int main(){ int x = 0; srand((unsigned)time(NULL)); x = rand() %10; printf("产生的随机数是:%d \n", x); 阅读全文

posted @ 2020-12-09 15:59 三日坊主i 阅读(57) 评论(0) 推荐(0)

C语言之Break函数和Continue函数

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int i=0; for (i = 1; i <= 10; i++) { if (i == 3) { break; } printf("%d\n", i); } printf(" \n"); int 阅读全文

posted @ 2020-12-09 15:55 三日坊主i 阅读(414) 评论(0) 推荐(0)

C语言之九九乘法口诀表

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= i; j++) { printf("%d*%d=%d ", i, j, i * j); } 阅读全文

posted @ 2020-12-09 15:51 三日坊主i 阅读(837) 评论(0) 推荐(0)

C语言之GoTo语句

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int x = 10; goto END; x == 20;END: printf("x的值是:%d \n", x); system("pause"); return 0;} 阅读全文

posted @ 2020-12-09 15:48 三日坊主i 阅读(189) 评论(0) 推荐(0)

C语言三目运算符

摘要: #include <stdio.h>#include <stdlib.h> int main(){ int x = 4; int y = x > 10 ? 100 : 2000; printf("y的值是:%d。\n", y); system("pause"); return 0;} 阅读全文

posted @ 2020-12-09 15:45 三日坊主i 阅读(207) 评论(0) 推荐(0)

C语言For循环

摘要: #include <stdio.h>#include <stdlib.h> int main(){ for (int x = 0; x < 10; x++) { printf("第%d次循环。 \n", x); } system("pause"); return 0;} 阅读全文

posted @ 2020-12-09 15:44 三日坊主i 阅读(98) 评论(0) 推荐(0)

C语言Do……While循环

摘要: #include <stdio.h> #include <stdlib.h> int main() { int x=0; do{ x++; printf("第%d次循环。",x); }while(x<10); system("pause"); return 0; } 阅读全文

posted @ 2020-12-09 15:42 三日坊主i 阅读(164) 评论(0) 推荐(0)

C语言While循环

摘要: #include <stdio.h> #include <stdlib.h> int main() { int x=0; while(x<10){ printf("第%d次循环。 \n",x); x++; } system("pause"); return 0; } 阅读全文

posted @ 2020-12-09 15:40 三日坊主i 阅读(56) 评论(0) 推荐(0)

C语言Switch分支

摘要: #include <stdio.h> #include <stdlib.h> int main() { int x=2; switch(x){ case 1: printf("x的值是1"); break; case 2: printf("x的值是2"); break; case 3: printf 阅读全文

posted @ 2020-12-09 15:31 三日坊主i 阅读(85) 评论(0) 推荐(0)

C语言If分支

摘要: #include <stdio.h> #include <stdlib.h> int main() { int x=12; if(x>10){ printf("x的值大于10 \n"); }else if(x<10){ printf("x的值小于10\n"); } system("pause"); 阅读全文

posted @ 2020-12-09 13:12 三日坊主i 阅读(120) 评论(0) 推荐(0)

导航