




已阅读5页,还剩21页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
沈阳理工大学课程设计专用纸No. 1课程设计任务书学 院信息科学与工程专 业通信工程学 生 姓 名Neko学 号10030603*设 计 题 目C语言课程设计内容及要求:加深对C语言基础知识的掌握,使用C语言编程实现以下题目的设计。题目名称: 数据分节与删除字符、学生成绩统计程序的设计内容及要求:1、编写一个程序,将某个位数不确定的正整数进行三位分节后输出,比如输入87654321,应输出87,654,3212、编写函数fun(char a,int k,int n),其功能是:删除字符串中指定下标开始的n个字符,形参中,a数组中存放字符串,k中存放指定下标。例如,若输入字符串为:Helloloa World!,k的值是5,n的值是3。应输出:Hello World!3、学生成绩统计程序设计设计结构体数组,结构中包含学生数据为:学号、姓名、物理分数、数学分数、外语分数、计算机分数。设计各个函数,分别实现以下功能:(1)输入学生数据 (2)显示所有学生信息 (3)统计每科的最高分、最低分;不及格人数、不及格学生的数据。设计菜单,通过选择菜单调用以上各函数。软件开发环境Windows XP,TC2.0或Visual C+ 6.0进度安排:第18周:C语言基础知识练习第18周:算法设计第19周:编写程序代码与程序调试第19周:答辩、验收程序指导教师(签字):年 月 日学院院长(签字):年 月 日沈阳理工大学沈阳理工大学课程设计专用纸No. 24目 录一、题目要求1二、算法设计2三、编程实现12四、结果分析19五、参考文献24一、题目要求题目名称: 数据分节与删除字符、学生成绩统计程序的设计内容:1、编写一个程序,将某个位数不确定的正整数进行三位分节后输出,比如输入87654321,应输出87,654,3212、编写函数fun(char a,int k,int n),其功能是:删除字符串中指定下标开始的n个字符,形参中,a数组中存放字符串,k中存放指定下标。例如,若输入字符串为:Helloloa World!,k的值是5,n的值是3。应输出:Hello World!3、学生成绩统计程序设计设计结构体数组,结构中包含学生数据为:学号、姓名、物理分数、数学分数、外语分数、计算机分数。设计各个函数,分别实现以下功能:(1)输入学生数据 (2)显示所有学生信息 (3)统计每科的最高分、最低分;不及格人数、不及格学生的数据。设计菜单,通过选择菜单调用以上各函数。要求:使用C语言完成上述程序的设计、编程和调试,开发环境可采用Turbo C 2.0、 WinTC或Visual C+ 6.0等。二、算法设计1.计算不确定位数正整数的位数,按照每三位为一节计算节数用于计算循环次数,计算并分配内存空间将其储存并逆序输出 是输入ai=1,temp=a,b=temp/10b0i=i+1,temp=b,b=temp/10i%3=0*p = (int *)malloc(c*sizeof(int),j=0jcc=i/3c=i/3+1j=j+1,d=a%1000,pc-j-1=d,a=a/1000开始否是否是否1j=0jcjc-1输出,pj输出pj结束是j=j+1否12、编写函数fun(char a,int k,int n) a中存放字符串 k为指定下标,n为删除字符串的长度,利用循环按照要求依次删除开始输出input string:输入a输出input k,n:调用fun()结束输入k,n开始istrlen(a)-ni=kai=ai+nai=0输出a是否结束i=i+13、学生成绩统计程序设计设计结构体数组,结构中包含学生数据为:学号、姓名、物理分数、数学分数、外语分数、计算机分数。设计各个函数,分别实现以下功能:(1)录入:输入学生数据 (2)显示:所有学生信息 (3)统计:统计每科的最高分、最低分;输出不及格人数、不及格学生的数据。设计菜单,通过选择菜单调用以上各函数。开始system(cls)输出tt*Students Grade Management System*ntt | 1. 输入 |ntt | 2. 显示|ntt | 3. 统计 |n tt | 0. 退出 |n tt*ntttGive your Choice(0-3):输入cc3return(c-0)结束是否menu_select()开始i=0signn且signN输出ttt学号:输出ttt姓名:输出ttt计算机分数:输入studn+i.num输出ttt外语分数:输入studn+i.m_Score.Mathematics输入studn+输出ttt物理分数:输入studn+i.m_Score.Computer输入studn+i.m_Score.ForeignLanguage输入studn+i.m_Score.Physics输入gets(x)输出tttany more records?(Y/N)输入sign输出ttt数学分数:i=i+1return(n+i)结束1122是否33input(Student stud,int n)开始输出ttt-n输出ttnumber name Phy Math Fore Compn输出ttt-ni1且i%10=0输出ttt-n输出tttsystem(pause)输出ttt-n输出tttsystem(pause)结束是否是否i=i+111223344display(Student stud,int n)statistic(Student stud,int n)开始i=0sum=0Physics_high = 0Mathematics_high = 0ForeignLanguage_high =0Computer_high = 0Physics_low = 0Mathematics_low = 0ForeignLanguage_low = 0Computer_low = 0in11是否studPhysics_high.m_Score.Physics studi.m_Score.PhysicsPhysics_low=i是否是否studi.m_Score.Physics 60输出studi.num,,studi.m_Score.PhysicsstudMathematics_high.m_Score.Mathematics studi.m_Score.MathematicsMathematics_low=istudi.m_Score.Mathematics 60输出studi.num,,studi.m_Score.MathematicsstudForeignLanguage_high.m_Score.ForeignLanguage studi.m_Score.ForeignLanguageForeignLanguage_low=i是否studi.m_Score.ForeignLanguage 60是否56statistic(Student stud,int n)输出studi.num,,studi.m_Score.ForeignLanguage56studComputer_high.m_Score.Computer studi.m_Score.ComputerComputer_low=i是否是否77studi.m_Score.Computer 60studi.num,,studi.m_Score.Physics是否i=i+18statistic(Student stud,int n)statistic(Student stud,int n)输出tttthe Physics hignest score:nstudPhysics_high.num,studPhysics_,studPhysics_high.m_Score.Physicstttthe Mathematics hignest score:nstudMathematics_high.num,studMathematics_,studMathematics_high.m_Score.Mathematicstttthe Foreign Language hignest score:nstudForeignLanguage_high.num,studForeignLanguage_,studForeignLanguage_high.m_Score.ForeignLanguagetttthe Computer hignest score:nstudComputer_high.num,studComputer_,studComputer_high.m_Score.Computernntttthe Physics lowest score:nstudPhysics_low.num,studPhysics_,studPhysics_low.m_Score.Physicstttthe Mathematics lowest score:nstudMathematics_low.num,studMathematics_,studMathematics_low.m_Score.Mathematicstttthe Foreign Language lowest score:nstudForeignLanguage_low.num,studForeignLanguage_,studForeignLanguage_low.m_Score.ForeignLanguagetttthe Computer lowest score:nstudComputer_low.num,studComputer_,studComputer_low.m_Score.Computer9结束开始n=0menu_select()=1menu_select()=2menu_select()=3menu_select()=0输出tttInput RecordsntttStatisticn输出tttDisplay All Recordsn输出tttn=Input(stu,n) breakDisplay(stu,n) breakStatistic(stu,n)system(pause) exit(0)输出tttsystem(pause) break输出tttHave a Good Luck,Bye-bye!n结束是否是否是否是否是否main()三、编程实现程序的具体C语言代码如下:第1题:#include#include int main()int a;scanf(%d,&a);int i=1,b;int temp =a; b = temp/10; while(b) i+; temp = b; b = temp/10; int c=(i%3=0)?i/3:(i/3+1);int *p = (int *)malloc(c*sizeof(int);int j,d; for(j=0;jc;j+) d=a%1000; pc-j-1 = d; a=a/1000; for(j=0;jc;j+) if(j !=c-1)printf(%d,pj); else printf(%d,pj); getchar(); getchar(); 第2题:#include#includevoid fun(char a,int k,int n);main() char a80; int k; int n; printf(input string:n); gets(a); printf(input k,n:n); scanf(%d,%d,&k,&n); fun(a,k, n); return 0;void fun(char a,int k,int n) int i; for(i=k;istrlen(a)-n;i+) ai=ai+n; ai=0; puts(a);第3题:#include /*引用库函数*/ #include #include #include typedef structint Physics;/*物理成绩*/int Mathematics;/*数学成绩*/int ForeignLanguage;/*外语成绩*/int Computer;/*计算机成绩*/Score;typedef struct /*定义结构体数组*/ char num10; /*学号*/ char name20; /*姓名*/ /int score; /*成绩*/ Score m_Score;Student; Student stu80; /*结构体数组变量*/ int menu_select() /*菜单函数*/ char c; do system(cls); /*运行前清屏*/ printf(tt*Students Grade Management System*n); /*菜单选择*/ printf(tt | 1. 输入 |n); printf(tt | 2. 显示|n); printf(tt | 3. 统计 |n); printf(tt | 0. 退出 |n); printf(tt*n); printf(tttGive your Choice(0-3):); c=getchar(); /*读入选择*/ while(c3); return(c-0); /*返回选择*/ int Input(Student stud,int n) /*输入若干条记录*/ int i=0; char sign,x10; /*x10为清除多余的数据所用*/ while(sign != n & sign != N) /*判断*/ printf(ttt学号:); /*交互输入*/ scanf(ttt%s,studn+i.num); printf(ttt姓名:); scanf(ttt%s,studn+); printf(ttt物理分数:); scanf(ttt%d,&studn+i.m_Score.Physics);printf(ttt数学分数:); scanf(ttt%d,&studn+i.m_Score.Mathematics); printf(ttt外语分数:); scanf(ttt%d,&studn+i.m_Score.ForeignLanguage); printf(ttt计算机分数:);scanf(ttt%d,&studn+i.m_Score.Computer); gets(x); /*清除多余的输入*/ printf(tttany more records?(Y/N); scanf(ttt%c,&sign); /*输入判断*/ i+; return(n+i); void Display(Student stud,int n) /*显示所有记录*/ int i; printf(ttt-n); /*格式头*/ printf(ttnumber name Phy Math Fore Compn); printf(ttt-n); for(i=1;i1&i%10=0) /*每十个暂停*/ printf(ttt-n); /*格式*/ printf(ttt); system(pause); printf(ttt-n); printf(ttt); system(pause); void Statistic(Student stud,int n) /*新增功能,输出统计信息*/ int i,sum=0;int Physics_high = 0;/*物理成绩*/int Mathematics_high = 0;/*数学成绩*/int ForeignLanguage_high = 0;/*外语成绩*/int Computer_high = 0;/*计算机成绩*/int Physics_low = 0;/*物理成绩*/int Mathematics_low = 0;/*数学成绩*/int ForeignLanguage_low = 0;/*外语成绩*/int Computer_low = 0;/*计算机成绩*/for(i=0;in;i+) /*循环输入判断*/ /*物理最高和最低分的判断*/if(studPhysics_high.m_Score.Physics studi.m_Score.Physics)Physics_low=i;/*不及格科目*/if(studi.m_Score.Physics 60)printf(ttt%-16s%-15s%d Phyn,studi.num,,studi.m_Score.Physics);/*数学最高和最低分的判断*/if(studMathematics_high.m_Score.Mathematics studi.m_Score.Mathematics)Mathematics_low=i;/*不及格科目*/if(studi.m_Score.Mathematics 60)printf(ttt%-16s%-15s%d Mathn,studi.num,,studi.m_Score.Mathematics);/*外语最高和最低分的判断*/if(studForeignLanguage_high.m_Score.ForeignLanguage studi.m_Score.ForeignLanguage)ForeignLanguage_low=i;/*不及格科目*/if(studi.m_Score.ForeignLanguage 60)printf(ttt%-16s%-15s%d Foren,studi.num,,studi.m_Score.ForeignLanguage);/*计算机最高和最低分的判断*/if(studComputer_high.m_Score.Computer studi.m_Score.Computer)Computer_low=i;/*不及格科目*/if(studi.m_Score.Computer 60)printf(ttt%-16s%-15s%d Compn,studi.num,,studi.m_Score.Computer);printf(tttthere are %d records.n,n*4); /*总共记录数*/ printf(tttthe Physics hignest score:n); /*物理最高分*/ printf(tttnumber:%s name:%s score:%dn,studPhysics_high.num,studPhysics_,studPhysics_high.m_Score.Physics); printf(tttthe Mathematics hignest score:n); /*数学最高分*/ printf(tttnumber:%s name:%s score:%dn,studMathematics_high.num,studMathematics_,studMathematics_high.m_Score.Mathematics); printf(tttthe Foreign Language hignest score:n); /*外语最高分*/ printf(tttnumber:%s name:%s score:%dn,studForeignLanguage_high.num,studForeignLanguage_,studForeignLanguage_high.m_Score.ForeignLanguage); printf(tttthe Computer hignest score:n); /*计算机最高分*/ printf(tttnumber:%s name:%s score:%dn,studComputer_high.num,studComputer_,studComputer_high.m_Score.Computer); printf(nn);printf(tttthe Physics lowest score:n); /*物理最低分*/ printf(tttnumber:%s name:%s score:%dn,studPhysics_low.num,studPhysics_,studPhysics_low.m_Score.Physics);printf(tttthe Mathematics lowest score:n); /*数学最低分*/ printf(tttnumber:%s name:%s score:%dn,studMathematics_low.num,studMathematics_,studMathematics_low.m_Score.Mathematics);printf(tttthe Foreign Language lowest score:n); /*外
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 药品注册审评员考核试题及答案
- 电梯安全管理人员月考试题库加答案
- 2025年度委托担保合同适用范围与条件
- 2025年度智能新能源汽车出租车运营合作协议书
- 2025年出租车夜班运营权承租及紧急救援服务合作协议
- 2025年度家庭装修半包装修服务协议范本
- 2025年度企业内部培训师认证授权培训合同范本
- 2025版教育培训课程体系订购协议
- 2025年度信息技术咨询与售后服务合同
- 2025版挖掘机销售与地下管网施工承包合同
- 2025年六安市裕安区石婆店镇公开招考村级后备干部8名笔试备考试题及答案解析
- 公司领导财务知识培训课件
- 2025年全国中小学校党组织书记网络培训示范班在线考试题库及答案
- 子痫患者护理查房
- 2024仁爱科普版八年级英语上册 Unit 1 Healthy Mind and Body(知识梳理与考点训练)解析版
- 医疗护理员职业技能竞赛试题及答案
- 出货标签管理办法
- 2025全国农业(水产)行业职业技能大赛(水生物病害防治员)选拔赛试题库(含答案)
- 旅游相册:宁夏旅游课件
- 药物化学(全套课件)
- 污水站沉淀池清淤及清洗工作施工方案
评论
0/150
提交评论