- 博客(9)
- 收藏
- 关注
转载 第七章
第七章 用函数实现模块化程序设计例7.1 调用函数输出结果例7.2 输入两个整数,要求输出其中的最大值例7.3 将7.2稍微改动,将在max函数中定义的变量z改为float例 7.4 输入两个整数求二者之和 例7.1 调用函数输出结果 # include <stdio.h> int main() { void print_message(); void print_star(); ...
2019-02-22 14:12:18
126
转载 第六章
第6章 利用数组处理批量的数据例6.1对是个数组元素0,1,2,3,4,5,6,7,8,9要求逆序输出例6.2 用数组解决斐波那契数列问题例6.3 有10个地区的面积,要求对他们由小到大的顺序排列例 6.4 将二维数组行列互换例6.5有一个3*4的矩阵要求输出其中最大的那个元素的值,以及行列号例6.6 输出已知字符串例6.7 输出一个菱形例6.8 输入一行字符,统计其中有多少个单词,单词之间用空格...
2019-02-22 14:11:32
151
转载 第五章
第五章 循环结构程序设计例5.1 求1+2+3+…+100.例5.2 用do…while求1+2+3+…+100.例5.3 while与do while比较例 5.4 在全系1000名学生中举行慈善捐募,当总数达到10万元时就结束,统计此时捐款人数以及平均没人捐款数目。例5.5 要求输出100~200的不能被3整除的数。例5.6 输出4*5矩阵例5.7 用公式π/4≈1-1/3+1/5-1/7+…...
2019-02-22 14:10:57
131
转载 第四章(2)
选择结构例4.7例4.8例4.9 例4.7 #include&lt;stdio.h&gt; int main() { void action1(int,int),action2(int,int); char ch; int a=15,b=23; ch=getchar(); switch(ch) { case 'a' : case'A' : action1(a,b);break; case'b' :...
2019-02-13 18:02:11
172
转载 第四章(1)
选择结构程序设计例4.1例4.2 输入两个实数,按由小到大的顺序输出这个数 例4.1 #include&amp;amp;lt;stdio.h&amp;amp;gt; #include&amp;amp;lt;math.h&amp;amp;gt; int main() { double a,b,c,disc,x1,x2,p,q; scanf(&amp;quot;%lf,%lf,%lf&amp;qu
2019-02-06 19:41:07
154
转载 第三章(2)
例3.7 # include <stdio.h> int main() { double a; a=10000/3.0; printf("%f\n",a); return 0; } 运行结果如下: 例3.8 先后输出BOY三个字符。 # include <stdio.h> int main() { char x='B',y='O',z='Y'; putchar...
2019-02-06 11:14:49
129
转载 第三章(1)
第三章 顺序程序设计例3.1华氏变摄氏例3.2 计算存款利息例3.3 给定一个大写字母,要求用小写输出例3.4 给出三角形的三边长,求三角形面积例3.5 求方程的根例3.6 用%f输出实数,只能得到6位小数 例3.1华氏变摄氏 #include<stdio.h> int main() { float f,c; f=64.0; c=(5/9)*(f-32); printf("%f%f\n...
2019-02-02 16:30:04
117
转载 第二章
第2章 算法——程序的灵魂例2.1求1*2*3*4*5例2.2 例2.1求12345 #include&amp;lt;stdio.h&amp;gt; int main() { int i,p=1; for(i=2;i&amp;lt;6;i++) p=p*i; printf(&quot;%d&quot;,p); return 0; } 运行结果为 例2.2 # include &
2019-01-28 14:47:11
104
转载 第一章
第一章程序设计和C语言例1.1要求在屏幕上输出以下一行信息例1.2求两个整数之和例1.3求两个整数中的较大者 例1.1要求在屏幕上输出以下一行信息 #include<stdio.h> int main() { printf("This is a C program.\n"); return 0; } 运行结果如下 例1.2求两个整数之和 #include<stdio.h>...
2019-01-27 11:10:44
94
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人