上一页 1 2 3 4 5 6 ··· 12 下一页
摘要: 任意输入 3 个整数,编程实现对这 3 个整数由小到大进行排序。 实现过程: (1)定义数据类型,本实例中 a、b、c、t 均为基本整型。 (2) 使用输入函数获得任意 3 个值赋给 a、b、c。 (3) 使用 if 语句进行条件判断,如果 a 大于 b,则借助于中间变量 t 互换 a 与 b 值, 阅读全文
posted @ 2020-08-13 21:51 C语言自学网 阅读(8009) 评论(0) 推荐(0) 编辑
摘要: 题目:有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学生号,姓名,三门课成绩),计算出平均成绩,况原有的数据和计算出的平均分数存放在磁盘文件"stud"中。 程序分析:无。 程序源代码: 1 #include<stdio.h> 2 #include<stdlib.h> 3 typede 阅读全文
posted @ 2020-08-13 21:43 C语言自学网 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 题目:有两个磁盘文件A和B,各存放一行字母,要求把这两个文件中的信息合并(按字母顺序排列),输出到一个新文件C中。 程序分析:你需要先创建 A.txt 与 B.txt。 A.txt文件内容: 123 B.txt文件内容: 456 程序源代码: 1 #include<stdio.h> 2 #inclu 阅读全文
posted @ 2020-08-13 21:41 C语言自学网 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 题目:从键盘输入一个字符串,将小写字母全部转换成大写字母,然后输出到一个磁盘文件"test"中保存。 输入的字符串以!结束。 程序分析:无。 程序源代码: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 int ma 阅读全文
posted @ 2020-08-13 21:26 C语言自学网 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题目:从键盘输入一些字符,逐个把它们送到磁盘上去,直到输入一个#为止。 程序分析:无。 实例: 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 FILE*fp=NULL; 6 char filename[25]; 7 char 阅读全文
posted @ 2020-08-13 21:23 C语言自学网 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 题目:计算字符串中子串出现的次数 。 程序分析:无。 实例: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int main() 5 { 6 int i,j,k,TLen,PLen,count=0; 7 char T[ 阅读全文
posted @ 2020-08-13 21:21 C语言自学网 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目:简单的结构体应用实例。 程序分析:无。 程序源代码: 1 #include <stdio.h> 2 3 struct programming 4 { 5 float constant; 6 char *pointer; 7 }; 8 9 int main() 10 { 11 struct pr 阅读全文
posted @ 2020-08-13 21:19 C语言自学网 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题目:猜谜游戏。 程序分析:无。 实例: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <time.h> 4 5 void caizi(void) 6 { 7 int n; 8 char begin; 9 int count = 1; 1 阅读全文
posted @ 2020-08-13 21:15 C语言自学网 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 题目:时间函数举例2 程序分析:无。 程序源代码: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <time.h> 4 5 int main() 6 { 7 long i=10000000L; 8 clock_t start,finish 阅读全文
posted @ 2020-08-13 21:08 C语言自学网 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目:时间函数举例2 程序分析:无。 程序源代码: 1 #include <stdio.h> 2 #include <time.h> 3 4 int main() 5 { 6 time_t start,end; 7 int i; 8 start=time(NULL); 9 for(i=0;i<300 阅读全文
posted @ 2020-08-13 21:07 C语言自学网 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 12 下一页