上一页 1 ··· 322 323 324 325 326 327 328 329 330 ··· 385 下一页
摘要: 1、c语言中定义函数和调用函数(计算三个数中的最大值) #include <stdio.h> int max3(int a, int b, int c) { int max = a; if (b > max) max = b; if (c > max) max = c; return max; } 阅读全文
posted @ 2021-03-24 10:08 小鲨鱼2018 阅读(3901) 评论(0) 推荐(0) 编辑
摘要: 1、求两个数中的较大值 #include <stdio.h> int main(void) { int i, j, max; puts("please input two integer!"); printf("i = "); scanf("%d", &i); printf("j = "); sca 阅读全文
posted @ 2021-03-24 09:52 小鲨鱼2018 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 1、函数定义和函数调用 #include <stdio.h> int max2(int a, int b) ## 函数头:返回类型, 函数名,形参声明a,形参声明b { if (a > b) return a; ## 函数体(复合语句) ## 函数定义 else return b; } int ma 阅读全文
posted @ 2021-03-24 09:26 小鲨鱼2018 阅读(782) 评论(0) 推荐(0) 编辑
摘要: 1、c语言中main函数和库函数 #include <stdio.h> int main(void) { /*.......*/ return 0; } 其中绿色部分称为main函数。 c语言程序中,main函数是必不可少的。程序运行的时候,会执行main函数的主体部分。 main函数中使用了pri 阅读全文
posted @ 2021-03-24 08:44 小鲨鱼2018 阅读(466) 评论(0) 推荐(0) 编辑
摘要: 1、虽然通过对象式宏来变更元素的数目非常方便,但是每次都需要对程序进行修改,然后重新编译执行。 我们可以定义一个比较大的数组,然后从头开始仅使用其中需要的部分。 #include <stdio.h> #define NUMBER 80 int main(void) { int i, j; int a 阅读全文
posted @ 2021-03-22 10:58 小鲨鱼2018 阅读(648) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> #define NUMBER 4 int main(void) { int i; int a[NUMBER]; int sum = 0; puts("please input the scores."); for (i = 0; i < NUMBER; i 阅读全文
posted @ 2021-03-21 18:29 小鲨鱼2018 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int num, i = 0, sum = 0, tmp; puts("please input the num."); printf("num = "); scanf("%d", &num); while (i < nu 阅读全文
posted @ 2021-03-21 09:16 小鲨鱼2018 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer!"); printf("j = "); scanf("%d", &j); for ( i = 1; i <= j; i++) { if 阅读全文
posted @ 2021-03-21 09:06 小鲨鱼2018 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j; puts("please input an integer!"); printf("j = "); scanf("%d", &j); for (i = 1; i <= j; i++ ) { if (j 阅读全文
posted @ 2021-03-16 22:57 小鲨鱼2018 阅读(737) 评论(0) 推荐(0) 编辑
摘要: 1、 偶数: #include <stdio.h> int main(void) { int i,j; puts("please input an integer!"); printf("j = "); scanf("%d", &j); for (i = 1; i <= j; i++) { if ( 阅读全文
posted @ 2021-03-16 22:45 小鲨鱼2018 阅读(1314) 评论(0) 推荐(0) 编辑
上一页 1 ··· 322 323 324 325 326 327 328 329 330 ··· 385 下一页