重庆美图库!!
查看: 830|回复: 1
打印 上一主题 下一主题
收起左侧

[原创]C语言_学习题套_第五套

[复制链接]
1
跳转到指定楼层
发表于 2007-2-1 13:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
重庆商务网,重庆电子商务第一网!

登陆享受更多浏览权限哟~

您需要 登录 才可以下载或查看,没有帐号?入驻经典 

x
<p>题目:学生成绩统计<br/>语言和环境<br/>实现语言<br/>C语言<br/>B、环境要求<br/>&nbsp;&nbsp; Turbo C 或 Turbo C 3.0<br/>要求<br/>请编写一个C语言程序,接收5个学生的信息,获得各自的3门课程中的最高分和最低分,并保存文件中。<br/>程序的功能要求如下:<br/>从键盘输入5个学生的基本信息(学号、姓名)和3门课程的考试成绩。<br/>比较每个学生3门课程考试成绩,获得3门课程中的最高分和最低分。<br/>将每个学生的信息保存在文件StudentScore.txt中,其中包括最高分和最低分。该文件应保存在C程序的同一文件夹中。<br/>算法与数据结构说明<br/>定义一个学生信息结构student(学号、姓名、3门课程的考试成绩、以及这3门课程中的最高分和最低分)。声明一个该结构的数组变量,分别利用函数high()和low()对输入学生的成绩进行比较,获得最高分和最低分,通过WriteFile()函数把每个学生的信息写入文件StudentScore.txt中来保存。<br/>推荐实践步骤<br/>编写main函数<br/>1)声明一个结构数组变量,用来存放5个学生的基本信息。<br/>2)从键盘输入5个学生的基本信息(学号、姓名)和3门课程的考试成绩。请见图1。<br/>&nbsp;<br/>Please input the 1 student information:<br/>Student number&lt;101~999&gt;:101<br/>Student name:Harry<br/>The 1 subject score:100<br/>The 2 subject score:99<br/>The 3 subject score:89<br/>Please input the 2 student information:<br/>Student number&lt;101~999&gt;:&nbsp; <br/>&nbsp;输入数据过程中,要求实现对学生信息有效性验证。具体要求如下:<br/>学生学号由3位数字组成。如果输入的学号大于999 或者小于101,程序应该给出错误提示信息“The number is wrong.Please repeat now.”,要求重新输入。<br/>每门课程的考试成绩的取值范围是:0到100 之内的整数或带一位小数的值。若不在这个范围之内,屏幕应该给出提示信息“The score is worng,Please reqeat now.”。详见图2。<br/>&nbsp;<br/>Please input the 1 student information:<br/>Student number&lt;101~999&gt;:10<br/>The number is worng.Pease repeat now.<br/>Student number&lt;101~999&gt;:101<br/>Student name:Harry<br/>The 1 subject score&lt;0——100&gt;:99.5<br/>The 2 subject score&lt;0——100&gt;:102<br/>The score is wrong.Please repeat now.<br/>The 2 subject score&lt;0——100&gt;:100<br/>The 3 subject score&lt;0——100&gt;:-25<br/>The score is wrong.Please repeat now.<br/>The 3 subject score&lt;0——100&gt;:69.5<br/>Please input the 2 student information:<br/>Student number (100——99): &nbsp; </p><p>&nbsp;&nbsp;&nbsp;&nbsp; (3 ) 调用函数high() 和 low() 分别对输入学生的成绩进行比较,获得最高分和最低分。<br/>&nbsp;&nbsp;&nbsp;&nbsp; (4 )输出这5个学生的基本信息和3门课程的考试成绩,以及其中得最高分和最低分。<br/>输出结果清参加图3.<br/>&nbsp;<br/>The 1 Student information:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student – no:101<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student –name:Harry<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 1 subject :100.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 2 subject:99.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 3 subject:89.0</p><p><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The highest score is 100.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The lowest score is 89.0<br/>The 2 Student information:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student – no:101<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student –name:Harry<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 1 subject :99.5<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 2 subject:100.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 3 subject:69.5</p><p><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The highest score is 100.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The lowest score is 69.5<br/>The 3 Student information:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student – no:102<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student –name:john<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 1 subject :89.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 2 subject:92.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 3 subject:94.0</p><p><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The highest score is 92.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The lowest score is 89.0&nbsp; <br/>&nbsp; (5) 通过WriteFile()函数把每个学生的信息写入文件StudentScore.txt中来保存。<br/>(6) 根据函数的返回值判断文件操作是否正常,并在屏幕上显示出相应得提示信息。<br/>要求:<br/>屏幕输出请参照图4。<br/>&nbsp;<br/>The 5 Student information:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student – no:104<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Student –name:hit<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 1 subject : 90.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 2 subject:92.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The 3 subject:88.0</p><p><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The highest score is 92.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The lowest score is 88.0<br/>The file successed.<br/>Prease any key to continue.&nbsp; <br/>2.编写high()子函数<br/>参数:<br/>&nbsp; 存放了学生3门课程的考试成绩的数组,float 类型。<br/>返回值:<br/>&nbsp; Float 类型,返回最高分数。<br/>功能:<br/>&nbsp;利用循环对存放了学生3 门课程的考试成绩的数组参数进行大小比较,返回3门课程的最高分。<br/>编写low()子函数<br/>参数:<br/>&nbsp; 存放了学生3门课程的考试成绩的数组,float 类型。<br/>返回值:<br/>&nbsp; Float 类型,返回最低分数。<br/>功能:<br/>&nbsp;利用循环对存放了学生3 门课程的考试成绩的数组参数进行大小比较,返回3门课程的最低分。<br/>编写writefile()子函数<br/>参数:<br/>存放5 个学生信息的结构数组,struct student * stu.<br/>返回值:<br/>&nbsp; 整型数。-1表示文件操作失败;0表示文件操作正常。<br/>功能:<br/>1)&nbsp;以写文本方式创建并打开文件。如有错误,2)&nbsp;返回-1。<br/>3)&nbsp;通过循环,4)&nbsp;把每个字符串写入文件“studentScore.txt”中。<br/>5)&nbsp;关闭文件。<br/>6)&nbsp;返回0。<br/>使用记事本打开StudentScore.txt文件,文件中保存的********如下图所示:<br/>&nbsp;<br/>101&nbsp;Harry&nbsp; 100.0&nbsp; 99.0&nbsp; 89.0&nbsp; 100.0&nbsp; 89.0<br/>102&nbsp;Mary&nbsp; 99.5&nbsp; 100.0&nbsp; 69.5&nbsp; 100.0&nbsp; 69.5&nbsp; <br/>103&nbsp;John&nbsp; 89.5&nbsp;&nbsp; 92.0&nbsp; 94.5&nbsp;&nbsp; 94.5&nbsp; 89.0<br/>104&nbsp;Macho 98.0&nbsp;&nbsp; 93.0&nbsp; 83.4&nbsp; 98.0&nbsp; 83.4<br/>105&nbsp;Hit&nbsp; 90.0&nbsp; 92.0&nbsp; 88.0&nbsp; 92.0&nbsp; 88.0&nbsp; </p><p>&nbsp;</p>
发布商机信息及企业宣传推广--请移步注册重庆商务网!!
快捷入口:给经典重庆客服留言
2
 楼主| 发表于 2007-2-1 13:18 | 只看该作者
您需要登录后才可以查看全部内容 登录 | 入驻经典
您需要登录后才可以回帖 登录 | 入驻经典  

本版积分规则

  • 欢迎关注重庆发展,多发帖多回帖才能持续保持帐号活力哟!请不要发表任何政 治,领 导,官 员,人 事及其它违法违规类言论,以免帐号被封禁。感谢您的支持和理解!
经典重庆旗下网站 | 24小时客服:13424176859 308675020

爱重庆,爱上经典重庆! 爱重庆,就上经典重庆!