1 2 3 4

随笔分类 -  C语言之结构化程序设计

包含流程控制语句,分支,循环。。。。
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 阅读(54) 评论(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 阅读(406) 评论(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 阅读(835) 评论(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 阅读(183) 评论(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 阅读(206) 评论(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 阅读(97) 评论(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 阅读(163) 评论(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 阅读(54) 评论(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 阅读(117) 评论(0) 推荐(0)

导航