摘要: 第1章(第四版)C语言程序设计练习 第2章(第四版)C语言程序设计练习 第3章(第四版)C语言程序设计练习 第4章(第四版)C语言程序设计练习 第5章(第四版)C语言程序设计练习 第6章(第四版)C语言程序设计练习 阅读全文
posted @ 2021-11-14 17:13 mljrm 阅读(49) 评论(0) 推荐(0)
摘要: 第1节-C语言 第2节-分支和循环语句 第3节-函数 第4章-数组 第五章-C语言操作符 第六章-指针 第七章-结构体 阅读全文
posted @ 2021-11-13 19:36 mljrm 阅读(36) 评论(0) 推荐(0)
摘要: 一、例题 1.调用函数,输出 *****************How do you do***************** #include<stdio.h> void print_star() { printf("*****************\n"); } void print_messa 阅读全文
posted @ 2021-11-26 21:49 mljrm 阅读(106) 评论(0) 推荐(0)
摘要: 一、例题 1.10个数组元素0~9,逆序输出 #include<stdio.h> int main() { int i = 9; int a[] = { 0,1,2,3,4,5,6,7,8,9 }; for (i = 9; i >= 0; i--) printf("%d\t", a[i]); ret 阅读全文
posted @ 2021-11-23 22:14 mljrm 阅读(1367) 评论(0) 推荐(0)
摘要: 一、例题 1. 1+2+3+···+100,即Σ100 n=1 n #include<stdio.h> int main() { int i = 1; int sum = 0; while (i<=100) { sum = sum + i; i++; } printf("%d", sum); ret 阅读全文
posted @ 2021-11-20 19:04 mljrm 阅读(206) 评论(0) 推荐(0)
摘要: 一、例题 1.求ax2+bx+c=0方程的根 #include<stdio.h> #include<math.h> int main() { double a, b, c; double x1, x2, x; printf("请输入a,b,c:\n"); scanf_s("%lf %lf %lf", 阅读全文
posted @ 2021-11-17 20:42 mljrm 阅读(253) 评论(0) 推荐(0)
摘要: 一、一维数组 1、 一维数组的创建和初始化 数组是一组相同类型元素的集合 (1)数组的创建 //语法形式 type_t arr_name[const_n]; //type_t 是指数组的元素类型 //const_n 是一个常量表达式,用来指定数组的大小 #include<stdio.h> int m 阅读全文
posted @ 2021-11-14 21:56 mljrm 阅读(133) 评论(0) 推荐(0)
摘要: 一、例题 1.温度转换(64ºF→17.8ºC) #include<stdio.h> int main() { float f = 0; float c = 0; scanf_s("%f", &f); printf("摄氏度为:%f\n华氏度为:%f\n", (5.0 / 9) * (f - 32. 阅读全文
posted @ 2021-11-14 17:12 mljrm 阅读(143) 评论(0) 推荐(0)
摘要: 一、函数 1. 函数是什么 (1)概念 函数是一个大型程序中的某部分代码, 由一个或多个语句块组成。它负责完成某项特定任务,而且相较于其他代码,具备相对的独立性。 一般会有输入参数并有返回值,提供对过程的封装和细节的隐藏。这些代码通常被集成为软件库。 #include<stdio.h> int Ad 阅读全文
posted @ 2021-11-13 16:43 mljrm 阅读(241) 评论(0) 推荐(0)
摘要: 一、例题 1.求5!(P33) #include <stdio.h> int main() { int i = 0; int ret = 1; for (i = 1; i <= 5; i++) { ret *= i; } printf("ret =%d\n", ret); return 0; } 2 阅读全文
posted @ 2021-11-12 19:26 mljrm 阅读(46) 评论(0) 推荐(0)