级C语言学生选课系统报告
- 格式:doc
- 大小:289.50 KB
- 文档页数:34
c语言课程设计 学生选课系统一、课程目标知识目标:1. 学生能理解C语言在开发学生选课系统中的应用,掌握基本的数据结构(如结构体、数组、链表)和文件操作相关知识。
2. 学生能运用C语言实现学生选课系统的基本功能,如学生信息管理、课程信息管理、选课操作等。
3. 学生能理解并掌握C语言中的模块化编程思想,将学生选课系统分解为多个函数,提高代码的可读性和可维护性。
技能目标:1. 学生能运用C语言编写、调试和运行学生选课系统,具备一定的编程实践能力。
2. 学生能通过团队协作,共同完成一个完整的学生选课系统项目,提高沟通与协作能力。
3. 学生能运用所学知识,对现有学生选课系统进行优化和改进,提高系统性能。
情感态度价值观目标:1. 学生通过本课程的学习,培养对计算机编程的兴趣和热情,树立学习C语言的自信心。
2. 学生在团队协作中,学会尊重他人意见,培养合作精神和团队意识。
3. 学生能够认识到编程在解决实际问题中的价值,提高将所学知识应用于实际生活的意识。
课程性质:本课程为C语言编程实践课程,旨在让学生通过动手实践,掌握C 语言编程技能,并运用所学知识解决实际问题。
学生特点:学生已具备一定的C语言基础,具备基本编程能力,但缺乏实际项目经验。
教学要求:注重理论与实践相结合,强调编程实践,培养学生解决实际问题的能力。
通过团队协作,提高学生的沟通与协作能力。
在教学过程中,关注学生的个体差异,因材施教,使每位学生都能在原有基础上得到提高。
二、教学内容1. 数据结构基础:回顾结构体、数组、链表等基本数据结构,讲解其在学生选课系统中的应用。
相关教材章节:第3章 数据类型与表达式,第4章 控制结构,第5章 函数,第6章 数组与字符串,第7章 指针与结构体。
2. 文件操作:介绍文件读写、文件管理等基本操作,为学生选课系统提供数据持久化支持。
相关教材章节:第10章 文件操作。
3. 模块化编程:讲解模块化编程思想,引导学生将学生选课系统分解为多个函数,提高代码的可读性和可维护性。
C语言学生管理系统课程设计报告1. 引言学生管理系统是一项常见的计算机应用程序,广泛应用于学校、培训机构等教育机构中。
本文将介绍一个基于C语言开发的学生管理系统,该系统具有以下功能:学生信息的录入、查询、修改和删除,以及成绩信息的录入、查询、统计和排序。
2. 系统设计2.1 功能模块学生管理系统主要包括以下功能模块:•学生信息录入模块:用于录入学生的基本信息,包括学号、姓名、性别、年龄等。
•学生信息查询模块:提供根据学号或姓名查询学生信息的功能。
•学生信息修改模块:允许修改学生的各项信息。
•学生信息删除模块:提供学生信息的删除功能。
•成绩信息录入模块:用于录入学生的成绩信息,包括科目和成绩。
•成绩信息查询模块:提供根据学号或科目查询学生成绩的功能。
•成绩统计模块:对学生的成绩进行统计,包括总分和平均分。
•成绩排序模块:按照总分对学生进行排序。
2.2 数据结构学生信息和成绩信息可以使用结构体存储。
定义如下:typedef struct {char id[20]; // 学生学号char name[20]; // 学生姓名char gender[5]; // 学生性别int age; // 学生年龄} Student;typedef struct {char id[20]; // 学生学号char subject[20]; // 科目float score; // 成绩} Score;通过结构体数组来存储多个学生的信息和成绩,如下所示:Student students[MAX_STUDENT_NUM];Score scores[MAX_SCORE_NUM];2.3 系统流程学生管理系统的流程图如下所示:graph LRA[学生信息录入] --> B[学生信息查询]A --> C[学生信息修改]A --> D[学生信息删除]A --> E[成绩信息录入]A --> F[成绩信息查询]A --> G[成绩统计]A --> H[成绩排序]3. 系统实现在C语言中,使用函数来实现不同的功能模块。
C语言学生管理系统课程设计报告一、引言学生管理系统是一种用来管理学生信息的软件系统。
C语言学生管理系统课程设计旨在帮助学生掌握C语言的基本语法和编程能力,同时熟悉软件开发过程中的分析、设计和实现等环节。
本报告将详细介绍C语言学生管理系统的设计和实现过程。
二、需求分析为了明确系统的功能需求,在进行系统设计之前,我们需要进行需求分析。
对于一个学生管理系统,常见的功能包括学生信息录入、查找学生信息、修改学生信息和删除学生信息等。
2.1 学生信息录入学生信息录入是系统的基本功能之一。
管理员可以通过系统按照一定的格式输入学生的基本信息,包括学号、姓名、性别、年龄、班级等。
2.2 查找学生信息系统应提供根据学号或姓名快速查找学生信息的功能。
用户可以输入学号或姓名进行查询,并显示该学生的详细信息。
2.3 修改学生信息管理员可以通过系统修改学生的基本信息。
用户可以选择指定要修改的学生的学号,并对学生的姓名、班级、年龄等信息进行修改。
2.4 删除学生信息管理员可以通过系统删除指定学生的信息。
用户可以输入学号或姓名进行查询,并选择删除该学生的信息。
三、系统设计在需求分析的基础上,进行系统设计是为了明确系统的整体架构和各个模块之间的关系。
本章将对C语言学生管理系统的设计进行详细介绍。
3.1 系统架构C语言学生管理系统采用单层架构,将所有功能模块整合在一个程序中。
系统采用面向过程的设计思路,通过函数的调用和参数传递实现不同模块之间的交互。
3.2 数据结构设计系统的核心数据结构是学生信息结构体。
学生信息结构体包括学号、姓名、性别、年龄、班级等字段。
为了方便管理学生的信息,可以使用链表来存储学生信息。
链表的每个节点代表一个学生,通过指针连接起来形成一个链表。
3.3 模块设计系统的功能可以划分为若干个模块,包括学生信息录入模块、查找学生信息模块、修改学生信息模块和删除学生信息模块。
3.3.1 学生信息录入模块学生信息录入模块通过从键盘读取用户输入的信息,并将输入的信息保存到链表中。
课程设计题目:选课管理系统《1》选课管理系统要求:•学生选课信息的添加(学生选课信息包括学生学号、课程名称、学分)•学生选课信息的删除•学生选课信息查询(查询每个学生的选课信息,每个学生选课的总学分,选具体某门课程(课程名输入)的学生名单))•《2》实现思路个人信息用结构体定义,解决的方案可以用结构体数组,或是链表作为临时数据处理,用文件来存储数据。
注意数据定义的数据类型,用函数实现相应的功能,然后在主程序中调用,程序运行的时候用菜单选择功能,然后进行相关操作。
1---------选课信息的添加------------2---------选课信息的删除------------3---------选课信息的修改------------4---------选课信息的查询------------5---------从文件读入学生信息--------------6---------------删除文件中学生信息-------------7---------------保存学生信息--------------------8----------------退出------------------------------《3》实验总结(分析程序的得与失)这个课题是设计一个成绩管理系统,该系统能够较好的管理好学生的成绩,也拥有比较完善的功能。
在编写过程中,我逐步的了解了程序模块化设计的思想含义。
在整个程序设计的过程中语法的错误还是比较容易检查的,但是对于那些逻辑思维的问题方面的缺陷不易查出,因此常常出现系统提示没有错误但是仍然不能够正常运行的境况,尽管有很多不足之处,但我在整个系统程序设计的过程中,我可以感受到自己对C语言有了一定的掌握,对整体的把握度也提高了很多。
《4》心得体会通过这周的编程我发现了自己的一些不足,在编写时经常犯一些低级错误,由于自己的马虎而浪费了不少时间。
在不知如何进行的时候有一种不自信,总想别人正在做什么,这些不足既然被发现就得在以后的做事中注意,争取改掉。
c语言学生管理系统课程设计报告(一)C语言学生管理系统课程设计报告1. 项目介绍•课程名称:C语言学生管理系统课程设计•项目类型:学生管理系统•设计时间:2021年1月•设计人员:XXX2. 项目背景•学生管理系统是一种常见的信息管理系统,用于管理学校、学院或班级的学生信息。
•C语言是一种常用的编程语言,具有良好的跨平台性和高效性。
3. 功能需求设计一个C语言学生管理系统,能够实现以下功能:•学生信息录入:输入学生的基本信息,包括学号、姓名、性别、年龄等。
•学生信息查询:根据学号或姓名查询学生的基本信息。
•学生成绩录入:输入学生的各科成绩,包括语文、数学、英语等。
•学生成绩统计:计算学生的总成绩、平均成绩,并根据成绩进行排名。
•学生信息修改:对已有的学生信息进行修改,包括基本信息和成绩信息。
•学生信息删除:根据学号或姓名删除学生的信息。
4. 技术实现在C语言学生管理系统的设计中,使用到以下技术:•结构体:用于定义学生的基本信息,如学号、姓名、性别、年龄等。
•数组:用于存储多个学生的信息。
•文件读写:将学生信息保存到文件中,实现信息的长久保存和读取。
5. 项目结构•主函数:包括用户菜单的选择和对应功能的调用。
•学生信息模块:实现学生信息的录入、查询、修改和删除等功能。
•成绩管理模块:实现学生成绩的录入、统计等功能。
6. 开发流程•需求分析:明确项目需求,确定功能设计。
•系统设计:设计程序的整体结构,划分模块和函数。
•编码实现:使用C语言编写各个模块的代码,并进行调试测试。
•系统测试:对系统进行整体测试,修复错误和漏洞。
•系统部署:将系统部署到目标环境中,进行性能优化和问题排查。
•用户培训:对系统进行使用说明和培训,保证用户能够熟练使用学生管理系统。
7. 总结与展望通过C语言学生管理系统的设计,我学到了很多关于C语言的基础知识和编程技巧。
在项目开发过程中,我充分利用了C语言的特点,编写出高效、稳定的代码。
c语言学生系统报告学生管理系统是管理学校学生信息的一个重要工具。
本系统使用C语言编写,实现了对学生信息的管理、增加、修改和查询功能,方便教师管理每个学生的个人信息和学习情况。
系统可以提高教师工作效率和管理水平,并能够迅速地处理学生信息,提高办公效率和工作效率。
一、需求分析此次系统的开发,主要是为了解决手动管理学生信息所带来的繁琐问题,达到高效的管理方式,实现以下需求:(1)方便快捷的输入、查询和管理学生信息。
(2)能够记录学生每次考试的成绩情况,方便教师进行评估。
(3)能够显示学生的年龄、性别、所在班级等信息,方便教师查看。
二、设计思路针对以上需求,设计了如下的系统结构:(1)数据采集模块:该模块用于对学生的基本信息进行录入,包括学生的姓名、年龄、性别、学号和班级等。
(2)数据管理模块:该模块用于对学生信息进行增加、修改和删除功能,实现对学生信息的管理。
(3)数据查询模块:该模块能够根据学生姓名、学号、班级等信息进行查询,方便教师快速查找学生信息。
三、系统功能实现(1)录入学生信息首先,系统需要录入学生的基本信息,包括学生的姓名、年龄、性别、学号和班级等,这些信息是后续管理工作的基础,教师需要认真核对每个学生的信息。
录入学生信息时,需要输入如下信息:姓名:请输入学生的姓名性别:请输入学生的性别(男/女)班级:请输入学生所在的班级在学生信息录入之后,系统需提供对学生信息的管理功能,包括增加、修改和删除功能。
教师可以根据需要对学生信息进行修改和删除操作。
具体功能如下:增加学生信息:在已有的信息中增加新学生信息。
修改学生信息:修改学生信息,如姓名、学号、年龄、性别、班级等。
删除学生信息:删除一位或多位学生的信息。
在系统中,教师可以根据关键字查询学生信息,包括学生姓名、学号、班级等信息。
系统会返回符合条件的学生记录。
具体查询功能如下:按姓名查询:输入学生姓名,返回该学生的所有信息。
建立查询、删除、增加和修改菜单方便用户进行操作。
C语言程序设计学校:学院:班级序号:学号::姓名指导老师:C语言程序设计报告一、C语言课程设计的目的:高级语言课程设计是学习完《高级语言程序设计》课程后进行的一次全面的综合性上机实验。
其目的在于为同学提供了一个既动手又动脑,独立实践的机会,将课本上的理论知识和实际有机的结合起来,锻炼同学的分析解决实际问题的能力。
提高学生适应实际,实践编程的能力。
二、题目学生选修课程系统设计假定有n门课程,每门课程有课程编号、课程名称、课程性质、总学时、授课学时、实验或商机学时、血粉、开课学期等信息,学生可按要求(如总学分不得少于60)自由选课。
1、要求:试设计一个选修课程系统,使之能提供以下功能:(1)系统以菜单方式工作。
(2)课程信息和学生选课信息输入功能(课程信息用文件保存)——输入。
(3)课程信息浏览功能——输出。
(4)查询功能(至少一种查询方式)——算法。
(5)按学分查询。
(6)某门课程学生选修情况(可选项)。
2、分析:由于题目要求将学生的选课信息用结构体形式输入,并写入文件中,所以应提供文件的输入输出等操作:在过程中需有浏览、插入、修改、查找、删除学生选课信息等操作,顾应分别建立个功能模块;另外还应提供键盘式选择菜单实现程序运行。
3、总体设计:根据题目要求,可以将系统分为六个模块:1)系统以菜单方式工作模块;2)课程信息与学生选课信息录入功能模块;3)课程信息浏览功能模块;4)查询模块;5)按学分查询模块;6)某些课程学生选修情况模块。
块设计:细4详#include <stdio.h>:程主流图#include <stdlib.h>#include <string.h>开始typedef struct subjects{int num; 显示一系列功能选择char name[20];char kind[10];int stime;N判断int ttime;int etime;int score;int term;结束struct subjects *next;}SUB;SUB *create_form(){SUB *head,*tail,*p;int num,stime,ttime;int etime,score,term;char name[20],kind[10];int size=sizeof(SUB);head=tail=NULL;牰湩晴尨输入选修课程信息:\n);scanf(%d %s %s %d %d %d %d %d,&num,&name,&kind,&stime,&ttime,&etime,&score,&term); while(num!=0){p=(SUB *)malloc(size);p->num=num;strcpy(p->name,name);strcpy(p->kind,kind);p->stime=stime;p->ttime=ttime;p->etime=etime;p->score=score;p->term=term;if(head==NULL)head=p;elsetail->next=p;tail=p;scanf(%d %s %s %d %d %d %d %d,&num,&name,&kind,&stime,&ttime,&etime,&score,&term);}tail->next=NULL;return head;}void savefile(SUB *head){ 开始SUB *p;FILE *fp;fp=fopen(subjects.txt,w); 输出写入文件并储存输入结束灦楲瑮?灦尬课程编号课程名称课程性质总学时授课学时实验或上机学时学分开课学期\n);for(p=head;p;p=p->next)fprintf(fp,]_x0012_s%9s??dd}\n,p->num,p->name,p->kind,p->stime,p->ttime,p->etime,p->score,p->term);fclose(fp);}void savefileadd(SUB *head){SUB *p;FILE *fp;fp=fopen(subjectsadd.txt,w);灦楲瑮?灦尬课程编号课程名称课程性质总学时授课学时实验或上机学时学分开课学期\n);for(p=head;p;p=p->next)fprintf(fp,]_x0012_s%9s??dd}\n,p->num,p->name,p->kind,p->stime,p->ttime,p->etime,p->score,p->te rm);fclose(fp);}void savefiledel(SUB *head){SUB *p;FILE *fp;fp=fopen(subjectsdel.txt,w);灦楲瑮?灦尬课程编号课程名称课程性质总学时授课学时实验或上机学时学分开课学期\n);for(p=head;p;p=p->next)fprintf(fp,]_x0012_s%9s??dd}\n,p->num,p->name,p->kind,p->stime,p->ttime,p->etime,p->score,p->te rm);fclose(fp);}void prin(SUB *head){SUB *ptr;if(head==NULL){牰湩晴尨没有此门课程记录!\n);return;}牰湩晴尨课程编号课程名称课程性质总学时授课学时实践或上机学时学分开课学期\n);for(ptr=head;ptr;ptr=ptr->next)printf(]_x0012_s%9s??dd}\n,ptr->num,ptr->name,ptr->kind,ptr->stime,ptr->ttime,ptr->etime,ptr->scor e,ptr->term);}void search(SUB *head) 开始{int a,num;打开文件查看学生选课信息int t=1;char type[10];char ch='a',ch1;21SUB *ptr;判断查询方法查分学按质性按课程输入结束while(ch!=' '){2:\n); 输入分查找请1程要按课性质查找请输入,若要按学若牰湩晴尨scanf(%d,&a); switch(a){:\n); 的性质入慣敳ㄠ瀺楲瑮?请输要查找的课程scanf(%s,type);或实践学程称名课性质总学时授课时程号程牰湩晴尨课编课\n); 学分学期开课时机上学for(ptr=head;ptr;ptr=ptr->next)if(strcmp(type,ptr->kind)==0){printf(]_x0012_s%9s??dd}\n,ptr->num,ptr->name,ptr->kind,ptr->stime,ptr->ttime,ptr->etime,ptr->scor e,ptr->term);t=0;}晩琨?牰湩晴尨未找到!\n);t=1;break;慣敳㈠瀺楲瑮?输入要查找的课程的学分\n);scanf(%d,&num);牰湩晴尨课程编号课程名称课程性质总学时授课学时实践或上机学时学分开课学期\n);for(ptr=head;ptr;ptr=ptr->next)if(ptr->score==num){printf(]_x0012_s%9s??dd}\n,ptr->num,ptr->name,ptr->kind,ptr->stime,ptr->ttime,ptr->etime,ptr->scor e,ptr->term);t=0;}晩琨?牰湩晴尨未找到!\n);t=1;}牰湩晴尨继续查找请按回车键,结束请按空格键:\n);ch1=getchar(); //将回车键赋给CH1,否则CASE里面最后输入的回车键会赋给CH,因此用CH1填补。
C语言大型作业实践报告计算机1001制作者:李菁华张兆丰秦恒加2011年6月题目:选修课程管理系统要求:假定有N门选修课,每门课有课程编号、名称、课程性质、总学时、授课学时、实验或上机学时、学分、开课学期等信息。
学生可按要求(如总学分不能少于20学分)选课。
▪课程信息维护,如录入、修改、删除等,课程信息用文件保存。
▪课程信息浏览—输出。
▪学生选课功能。
▪查询功能包括:按学分、课程性质、学生等查询。
▪统计功能。
统计各门课程的选修人数。
▪本系统要有通用性、界面美观、操作方便。
要考虑系统安全。
具体算法流程设计思路(流程图):程序源代码:#include<stdio.h>#include<time.h>#include<string.h>#include<conio.h>main(){intx,xi,choice2,choice3,choice4,choice8,q=0,filein=0,limit=0,i,num,tonum,tcnum,ecnum ,score,term,student,A,io=0,screen=0;/*-----变量定义区-----,x为现有选修课数量,目前不能超过10,后续与主程序合并时移动到定义区,xi为选修课信息录入循环变量*/char choice1,choice5,choice6,choice7,name[10],kind[10];int carenum[10]={0,0,0,0,0,0,0,0,0,0}; /*用于统计每门课程选修人数*/int o,change=0,delatenum,e,u,stui=0,stuc=0;struct elective /*选修课程信息结构体*/{int electivenum; /*选修课编号*/char electivename[10]; /*选修课课名*/char electivekind[10]; /*选修课性质,暂定考试考查之分*/int totalclassnum; /*总课时*/int techclassnum; /*授课课时*/int expclassnum; /*实验课时*/int credits; /*学分*/int classterm; /*开课学期*/int students; /*此门课选修人数*/};struct muticlass /*学生选择的课程信息结构体*/{int stuchoice;int stuclassnum;char stuclassname;};struct student /*学生信息结构体*/{char stuname[10];long stunum;int stucredits;struct muticlass mutichoice[20]; /*暂定每名学生最多选20门课*/ /*本结构体为嵌套结构体,完善功能时请注意嵌套结构*/};struct student studentcare[100]; /*暂定最多可以有100名学生选课*/struct elective electivedata[10]; /*最多10门选修课*/FILE *electivefp; /*选修课程信息文件指针*/FILE *stufp; /*学生信息文件指针*/FILE *outfp; /*课程信息输出文件指针*/FILE *find;long now,midkey; /*now为密码算法中间变量,midkey为密码算法最终结果*/int chancenum=0,m; /*chancenum为输入密码错我次数计数变量,m为主目录选择判断变量*/unsigned long password,password2;struct tm *timenow; /*timenow为标准系统时间提取指针*/textcolor(WHITE);system("cls");gotoxy(20,12);cprintf("Welcome to the Elective management system"); /*一级主菜单*/gotoxy(1,24);system("pause");t2:system("cls");gotoxy(24,11);cprintf("1.Students elective course system");gotoxy(24,12);cprintf("2.Elective information output");gotoxy(24,13);cprintf("3.Elective course information searching");gotoxy(24,14);cprintf("4.I'm the administrator!");gotoxy(24,15);cprintf("5.Exit the system");gotoxy(24,16);scanf("%d",&choice8);switch(choice8){case 1: limit=0;goto students1;case 2: goto x11;case 3: goto x12;case 4: goto x7;case 5: goto x3;default: system("cls");gotoxy(20,12);cprintf("wrongchoice");gotoxy(1,24);system("pause");goto t2;}x7:textcolor(YELLOW); /*-----密码判断模块-----*/time(&now);midkey=now;midkey=midkey/100;password=midkey;return2:system("cls");gotoxy(22,15);cprintf("Enter 1 to refresh the password.");gotoxy(25,12);cprintf("Please enter your password\n");gotoxy(25,13);scanf("%ld",&password2); /*password2为用户输入的密码变量*/ if(chancenum<4) /*用户输入密码错误次数判断*/{if(password2==password){limit=1;goto x4;}else{if(password2==1){goto x7;}else{system("cls");gotoxy(22,12);textcolor(RED);cprintf("password error");gotoxy(18,13);cprintf("please enter the right password");gotoxy(20,14);cprintf("You have only %d chances",3-chancenum);gotoxy(1,24);system("pause");if(chancenum==3) /*连续4次输入错误密码判断*/{goto x6;}chancenum=chancenum+1;goto return2;}}}x6:system("cls");gotoxy(20,12);cprintf(" Sorry,you have null chance.");gotoxy(1,24);goto x5; /*-----密码判断模块结束-----*/x4:switch(limit){case 0: textcolor(YELLOW);goto students1;case 1: textcolor(GREEN);goto t3;default: textcolor(RED);system("cls");gotoxy(20,12);cprintf("None Limited");gotoxy(1,24);system("pause");textcolor(WHITE);goto t2;}t3:textcolor(GREEN); /*-----主程序开始-----*/system("cls");gotoxy(20,12);cprintf("Welcome to the Elective management system"); /*一级主菜单*/gotoxy(1,24);system("pause");return1:system("cls");gotoxy(24,3);cprintf("Elective management system"); /*选修课管理系统*/gotoxy(24,11);cprintf("1.Students elective course system."); /*学生选课系统*/gotoxy(24,12);cprintf("2.Elective course maintenance system."); /*课程信息维护系统*/gotoxy(24,13);cprintf("3.Exit the system."); /*退出系统*/gotoxy(24,14);scanf("%d",&o);switch(o){case 1: goto students1;case 2: goto electivemans1;case 3: goto x3;default: system("cls");gotoxy(12,12);cprintf("error choice,please make your choice again\n");gotoxy(1,24);system("pause");goto return1;}electivemans1:system("cls");change=0;gotoxy(24,3);cprintf("Elective management system"); /*二级主菜单*/gotoxy(24,11);cprintf("1.New elective database"); /*新建选修课程信息*/gotoxy(24,12);cprintf("2.Maintain elective database"); /*修改选修课程信息*/gotoxy(24,13);cprintf("3.Show the number of statistical electives"); /*统计每门课程选修人数*/gotoxy(24,14);cprintf("4.Elective information output"); /*课程信息输出*/gotoxy(24,15);cprintf("5.Return to the main menu"); /*返回主菜单*/gotoxy(24,16);scanf("%d",&m);switch(m) /*主目录跳转判断*/{case 1: goto x1;case 2: goto x2;case 3: goto x8;case 4: goto x11;case 5: goto return1;default: system("cls");gotoxy(12,12);cprintf("error choice,please make your choice again\n");gotoxy(1,24);system("pause");goto electivemans1;}x3:system("cls");gotoxy(25,12);cprintf("Thanks for using thissystem");gotoxy(1,24);goto x5;x1:electivefp=fopen("elective.dat","w+"); /*-----选修课程信息新建模块-----*/ if((electivefp=fopen("elective.dat","w+"))==NULL){gotoxy(12,12);cprintf("connot open this file");gotoxy(11,13);cprintf("Please debug this program");gotoxy(12,17);system("pause");goto z1;}system("cls");gotoxy(12,12);cprintf("Please according to clew input elective course information");gotoxy(1,24);system("pause");a1:system("cls");gotoxy(12,12);cprintf("Please input the elective quantity,Up to 10."); /*输入此次录入选修课程门数*/gotoxy(14,13);scanf("%d",&x); /*输入选修课总课程数*/if(x>10) /*总课程数小于10判断*/{system("cls");gotoxy(12,12);cprintf("Up to 10");gotoxy(1,24);system("pause");goto a1;}for(xi=0;xi<x;xi++) /*课程信息录入*/{r1:system("cls"); /*课程信息开始录入*/gotoxy(12,11);cprintf("Please enter the No.%d elective course numbers",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].electivenum);if(q==1){goto z4;}r2:system("cls");gotoxy(12,11);cprintf("Please input the name of the No.%d elective course class",xi+1);gotoxy(12,12);scanf("%s",&electivedata[xi].electivename);if(q==1){goto z4;}r3:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective properties,\"exam\" or \"examines\"",xi+1);gotoxy(12,12);scanf("%s",&electivedata[xi].electivekind);if(q==1){goto z4;}r4:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective total class number",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].totalclassnum);if(q==1){goto z4;}r5:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective lecture class number",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].techclassnum);if(q==1){goto z4;}r6:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective the experiment class number",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].expclassnum);if(q==1){goto z4;}r7:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective credits",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].credits);if(q==1){goto z4;}r8:system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective course semesters",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].classterm);if(q==1){goto z4;}if(xi<(x-1)){system("cls");gotoxy(12,12);cprintf("This elective information recorded success, please enter the next");gotoxy(1,24);system("pause");}} /*课程信息录入结束*/z4:system("cls"); /*课程信息输入正确性判断*/gotoxy(12,12);cprintf("If information recorded correctly?");gotoxy(14,13);cprintf("Enter \"y\" for Yes,\"n\" for No");gotoxy(14,14);scanf("%c",&choice1);switch(choice1){case 121: goto z2;case 110: goto z3;default: system("cls");gotoxy(12,12);cprintf("Wrong choicePlease make it again.");gotoxy(1,24);system("pause");goto z4;}z3:{ /*错误信息定位*/system("cls");gotoxy(8,5);cprintf("What message entry errors?");gotoxy(12,6);cprintf("1.elective course numbers");gotoxy(12,7);cprintf(" of elective course class");gotoxy(12,8);cprintf("3.elective properties");gotoxy(12,9);cprintf("4.elective total class number");gotoxy(12,10);cprintf("5.elective lecture class number");gotoxy(12,11);cprintf("6.elective experiment class number");gotoxy(12,12);cprintf("7.elective credits");gotoxy(12,13);cprintf("8.elective course semesters");gotoxy(12,14);cprintf("9.Add a elective course lesson.");gotoxy(12,15);cprintf("10.Delate a elective course lesson.");gotoxy(12,16);scanf("%d",&choice2); /*错误项目定位*/system("cls");if(choice2==9){goto r9;}elseif(choice2==10){goto r10;}else{goto z6;}z6:system("cls");gotoxy(12,12);cprintf("Which group of curriculum information need to modify?"); gotoxy(12,13);scanf("%d",&choice3); /*错误组别定位*/if(choice3<x+1&&choice3>0){goto z7;}else{system("cls");gotoxy(12,12);cprintf("Wrong group,please enter again");gotoxy(1,24);system("pause");goto z6;}z7:xi=choice3-1;switch(choice2) /*错误信息修改*/{case 1: q=1;goto r1;case 2: q=1;goto r2;case 3: q=1;goto r3;case 4: q=1;goto r4;case 5: q=1;goto r5;case 6: q=1;goto r6;case 7: q=1;goto r7;case 8: q=1;goto r8;case 9: q=1;goto r9;case 10: q=1;goto r10;default: system("cls");gotoxy(12,12);cprintf("Wrong choice.Please make it again.");gotoxy(1,24);system("pause");goto z3;}}z2:if(change==0){goto write1;}else{remove("elective.dat");electivefp=fopen("elective.dat","w+");goto write1;}write1:fprintf(electivefp,"%d \n",x);for(xi=0;xi<x;xi++) /*将完善的课程信息以文件的形式保存在磁盘上*/{electivedata[xi].students=0;fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenu m,electivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalcla ssnum,electivedata[xi].techclassnum,electivedata[xi].expclassnum,electivedata[xi].cr edits,electivedata[xi].classterm,electivedata[xi].students);}filein=1;z1:{system("cls");gotoxy(12,12);cprintf("Elective course information input success!");gotoxy(1,24);system("pause");}goto return1; /*返回主菜单*/x2:change=1;if(filein==1){goto z3;}electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electiven um,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].t otalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiv edata[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}goto z3;r9:x=x+1;system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective course numbers",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].electivenum);system("cls");gotoxy(12,11);cprintf("Please input the name of the No.%d elective course class",x);gotoxy(12,12);scanf("%s",&electivedata[x-1].electivename);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective properties,\"exam\" or \"examines\"",x);gotoxy(12,12);scanf("%s",&electivedata[x-1].electivekind);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective total class number",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].totalclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective lecture class number",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].techclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective the experiment class number",x); gotoxy(12,12);scanf("%d",&electivedata[x-1].expclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective credits",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].credits);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective course semesters",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].classterm);goto z4;r10:system("cls");gotoxy(12,12);cprintf("Which group of elective do you want to delate?");gotoxy(12,13);scanf("%d",&delatenum);if(delatenum>0||delatenum<x){for(e=0;e<x-delatenum;e++){electivedata[delatenum+e-1]=electivedata[delatenum+e];}x=x-1;remove("elective.dat");electivefp=fopen("elective.dat","w+");}else{system("cls");gotoxy(12,12);cprintf("we do not have that group of elective information");gotoxy(1,24);system("pause");goto r10;}goto z4;students1:{electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}stufp=fopen("stu.dat","r+");return4:system("cls");gotoxy(12,12);cprintf("Please enter your name");gotoxy(12,13);scanf("%s",&studentcare[stui].stuname);system("cls");gotoxy(12,12);cprintf("Please enter your student ID");gotoxy(12,13);scanf("%ld",&studentcare[stui].stunum);care2:system("cls");gotoxy(3,2);cprintf("Existing elective");for(u=0;u<x;u++){gotoxy(5,u+3);cprintf("%d.num:%dname:%s\n",u+1,electivedata[u].electivenum,electivedata[u].electivename);}gotoxy(5,x+4);cprintf("Which are you interested?");gotoxy(5,x+5);scanf("%d",&choice4);return3:system("cls");gotoxy(3,2);cprintf("Elective information");gotoxy(4,4);cprintf("Num:%d",electivedata[choice4-1].electivenum);gotoxy(4,5);cprintf("Name:%s",electivedata[choice4-1].electivename);gotoxy(4,6);cprintf("Kind:%s",electivedata[choice4-1].electivekind);gotoxy(4,7);cprintf("Total class:%d",electivedata[choice4-1].totalclassnum);gotoxy(4,8);cprintf("Tech class:%d",electivedata[choice4-1].techclassnum);gotoxy(4,9);cprintf("Exp class:%d",electivedata[choice4-1].expclassnum);gotoxy(4,10);cprintf("Credits:%d",electivedata[choice4-1].credits);gotoxy(4,11);cprintf("Class term:%d",electivedata[choice4-1].classterm);gotoxy(4,14);cprintf("Sure to choose this course? enter \"y\" for yes,\"n\" for no");gotoxy(4,15);scanf("%c",&choice5);switch(choice5){case 121: goto care1;case 110: goto care2;default: system("cls");gotoxy(12,12);cprintf("wrong choice");goto return3;}care1:if(stuc>0){for(xi=0;xi<stuc+1;xi++){if(choice4==studentcare[stui].mutichoice[xi].stuclassnum){system("cls");gotoxy(12,12);cprintf("Connot repeat courses");gotoxy(1,24);system("pause");goto care2;}}}carenum[choice4-1]++;electivedata[choice4-1].students=carenum[choice4-1];studentcare[stui].mutichoice[stuc].stuchoice=choice4;studentcare[stui].stucredits=studentcare[stui].stucredits+electivedata[choice4-1 ].credits;studentcare[stui].mutichoice[stuc].stuclassnum=electivedata[choice4-1].elective num;studentcare[stui].mutichoice[stuc].stuclassname=electivedata[choice4-1].electiv ename;x10:system("cls");gotoxy(12,12);cprintf("Course whether end? enter \"y\" for yes,\"n\" for no");gotoxy(12,13);scanf("%c",&choice6);switch(choice6){case 121: goto x9;case 110: stuc++;goto care2;default: system("cls");gotoxy(12,12);cprintf("wrongchoice");gotoxy(1,24);system("pause");goto x10;}x9:if(studentcare[stui].stucredits<20){system("cls");gotoxy(12,12);cprintf("Attention!Total credits less than 20!");gotoxy(1,24);system("pause");goto x10;}else{remove("stu.dat");stufp=fopen("stu.dat","a+");fprintf(stufp,"%d \n",stui);system("cls");gotoxy(12,12);cprintf("Elective success!");gotoxy(1,24);system("pause");return6:system("cls");gotoxy(12,12);cprintf("If others need courses? enter \"y\" for yes,\"n\" for no");gotoxy(12,13);scanf("%c",&choice7);switch(choice7){case 121: stui++;goto return4;case 110: goto return5;default: system("cls");gotoxy(12,12);cprintf("wrong choice");gotoxy(1,24);system("pause");goto return6;}return5: for(u=0;u<stui+1;u++){fprintf(stufp,"%s %ld %d\n",studentcare[u].stuname,studentcare[u].stunum,studentcare[u].stucredits);for(xi=0;xi<stuc+1;xi++){fprintf(stufp,"%d %d %s\n",studentcare[u].mutichoice[xi].stuchoice,studentcare[u].mutichoice[xi].stuclassnu m,studentcare[u].mutichoice[xi].stuclassname);}}remove("elective.dat");electivefp=fopen("elective.dat","w+");fprintf(electivefp,"%d \n",x);for(xi=0;xi<x;xi++) /*将完善的课程信息以文件的形式保存在磁盘上*/{fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenum,el ectivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalclassnu m,electivedata[xi].techclassnum,electivedata[xi].expclassnum,electivedata[xi].credits ,electivedata[xi].classterm,electivedata[xi].students);}switch(limit){case 1: goto return1;case 0: goto t2;default: goto t2;}}}x8:electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}system("cls");gotoxy(3,4);cprintf("Elective toll");for(u=0;u<x;u++){gotoxy(3,u+6);cprintf("%s : %d",electivedata[u].electivename,electivedata[u].students);}gotoxy(1,18);system("pause");goto electivemans1;x11:system("cls"); /*-----查找模块-----*/electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}outfp=fopen("electiveinformation.doc","w+");fprintf(outfp,"选修课程信息\n\n\n\n");for(xi=0;xi<x;xi++){fprintf(outfp,"课程编号:%d \n课程名:%s \n课程种类:%s \n总课时:%d \n教学课时:%d \n实验课时:%d \n学分:%d \n开课学期:%d \n已选人数:%d\n\n\n",electivedata[xi].electivenum,electivedata[xi].electivename,electivedat a[xi].electivekind,electivedata[xi].totalclassnum,electivedata[xi].techclassnum,electiv edata[xi].expclassnum,electivedata[xi].credits,electivedata[xi].classterm,electivedata [xi].students);}switch(limit){case 1: goto electivemans1;case 0: goto t2;default: goto t2;}x12:{find=fopen("elective.dat","r+");fscanf(find,"%d \n",&x);for(i=0;i<x;i++){fscanf(find,"%d %s %s %d %d %d %d %d %d\n",&electivedata[i].electivenum,&el ectivedata[i].electivename,&electivedata[i].electivekind,&electivedata[i].totalclassnu m,&electivedata[i].techclassnum,&electivedata[i].expclassnum,&electivedata[i].credi ts,&electivedata[i].classterm,&electivedata[i].students);}xx:io=0;system("cls");gotoxy(7,3);printf("a:search by electivenum;\n b:search by electivename;\nc:search by electivekind;\n d:search by totalclassnum;\n e:search by techclassnum;\n f:search by expclassnum;\n g:search by credits;\n h:search by classterm;\n i:search by students\n");gotoxy(7,12);cprintf("j:Return to the main menu");gotoxy(7,13);scanf("%c",&A);switch(A){case 97: goto a;case 98: goto b;case 99: goto c;case 100: goto d;case 101: goto e;case 102: goto f;case 103: goto g;case 104: goto h;case 105: goto i;case 106: goto t2;default: system("cls");gotoxy(24,12);cprintf("wrongchoice\n");system("pause");goto xx;}a:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivenum\n");gotoxy(24,13);scanf("%d",&num);system("cls");for(i=0; i<x; i++){if(electivedata[i].electivenum==num){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}b:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivename\n");gotoxy(24,13); scanf("%s",&name);system("cls");for(i=0; i<x; i++){if(strcmp(electivedata[i].electivename,name)==0){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;}}if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}c:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivenkind\n");gotoxy(24,13); scanf("%s",&kind);system("cls");for(i=0; i<x; i++){if(strcmp(electivedata[i].electivekind,kind)==0){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1; screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}d:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the totalclassnum\n");gotoxy(24,13); scanf("%d",&tonum);system("cls");for(i=0; i<x; i++){if(electivedata[i].totalclassnum==tonum){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}e:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the techclassnum\n");gotoxy(24,13); scanf("%d",&tcnum);system("cls");for(i=0; i<x; i++){if(electivedata[i].techclassnum==tcnum){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);。
课程设计报告课程设计题目:学生选课管理系统学号:09110712姓名:李唐松专业:软件工程班级: 091107指导老师:谢小林2009年1月5日星期二*实验题目:学分管理程序*实验时间与地点:2009年1月7日星期四软件楼508*实验目的:1综合运用所学的C语言知识进行编程。
2进一步了解掌握C的基本语法。
3开始逐步培养编程思维,完善编程思维漏洞。
4侧重对C中数组函数指针结构体和文件等相关内容的综合应用。
4进一步提升自己的编程能力,为以后学习开始奠基。
*实验要求:1学生选课信息的添加(学生选课信息包括学生学生学号、课程名称、学分)2学生选课信息的删除3学生选课信息的查询(查询每个学生的选课信息,每个学生选课的总学分,选具体某门课程(课程名输入)的学生名单)*实验思路:1.函数定义判断,调用函数实现函数功能。
2.首先自定义函数,做出主菜单。
3.运用do….while , switch 语句完成主函数。
4.主程序中调用函数,程序运行时实现菜单选择功能。
5.自定义函数主要if语句完成,注重函数的应用。
*流程图:A主干图B具体流程:*程序操作:#i n c l u d e<s t d i o.h>#i n c l u d e<s t r i n g.h>#i n d e f i n e s i z e10s t r u c t c o u r s e{l o n g n u m;c h a r c o u r s e1[20];i n t s c o r e1;c h a r c o u r s e2[20];i n t s c o r e2;c h a r c o u r s e3[20];i n t s c o r e3;c h a r c o u r s e4[20];i n t s c o r e4;}c o u r s e[s i z e];v o i d m e n u(){p r i n t f(“*************************\n”); p r i n t f(“学生选课管理系统\n”);p r i n t f(“************************\n”); p r i n t f(“0退出程序\n“);p r i n t f(“1学生选课信息的添加\n”);p r i n t f(“2学生选课信息的删除\n”);p r i n t f(“3学生选课信息的查询\n”);p r i n t f(“请输入0~3\n”);}v o i d s u r e(){i n t i;f o r(i=0;i<s i z e;i++)p r i n t f(“学号:\n”);s c a n f(“%l d”,c o u r s e[i].n u m);p r i n t f(“课程1:\n”);s c a n f(“%s”,c o u r s e[i].c o u r s e1);p r i n t f(“学分1:\n”);s c a n f(“%d”,c o u r s e[i].s c o r e1);p r i n t f(“课程2:\n”);s c a n f(“%s”,c o u r s e[i].c o u r s e2);p r i n t f(“学分2:\n”);s c a n f(“%d”,c o u r s e[i].s c o r e2);p r i n t f(“课程3:\n”);s c a n f(“%s”,c o u r s e[i].c o u r s e3);p r i n t f(“学分3:\n”);s c a n f(“%d”,c o u r s e[i].s c o r e3);p r i n t f(“课程4:\n”);s c a n f(“%s”,c o u r s e[i].c o u r s e1);p r i n t f(“学分4:\n”);s c a n f(“%d”,c o u r s e[i].s c o r e4);i f(s t r c m p(c o u r s e[i].c o u r s e1)==0)r e t u r n;i f(s t r c m p(c o u r s e[i].c o u r s e2)==0)r e t u r n;i f(s t r c m p(c o u r s e[i].c o u r s e3)==0)r e t u r n;i f(s t r c m p(c o u r s e[i].c o u r s e4)==0)r e t u r n;}v o i d d e l(){i n t i;l o n g n;p r i n t f(“请输入学号:\n”);s c a n f(“%l d”,&n);f o r(i=0;i<=s i z e;i++)i f(c o u r s e[i].n u m==n)c o u r s e[i].n u m=c o u r s e[i+1].n u ms t r c p y(c o u r s e[i].c o u r s e1,c o u r s e[i+1].c o u r s e1);c o u r s e[s i z e].c o u r s e1=”\o”c o u r s e[i].s c o r e1=c o u r s e[i+1].s c o r e2;c o u r s e[i].s c o r e2=c o u r s e[i+1].s c o r e3;c o u r s e[i].s c o r e3=c o u r s e[i+1].s c o r e4;}v o i d o p e n(){i n t i;l o n g n;i n t s c o r e;p r i n t f(“请输入学号:”);s c a n f(“%l d”,&n);f o r(i=0;i<s i z e;i++)i f(c o u r s e[i].n u m==n){p r i n t f(“学号:%l d”,c o u r s e[i].n u m);p r i n t f(“课程1:%s”,c o u r s e[i].c o u r s e1);p r i n t f(“学分1:%d”,c o u r s e[i].s c o r e1);p r i n t f(“课程2:%s”,c o u r s e[i].c o u r s e2);p r i n t f(“学分2:%d”,c o u r s e[i].s c o r e2);p r i n t f(“课程3:%s”,c o u r s e[i].c o u r s e3);p r i n t f(“学分3:%d”,c o u r s e[i].s c o r e3);p r i n t f(“课程4:%s”,c o u r s e[i].c o u r s e4);p r i n t f(“学分4:%d”,c o u r s e[i].s c o r e4);s c o r e=c o u r s e[i].s c o r e1+c o u r s e[i].s c o r e2+c o r s e[i].s c o r e3+c o u r s e[i].s c o r e4; p r i n t f(“总学分:%d”,s c o r e);}v o i d m a i n(){i n t n;s c a n f(“%d”,&n);d o{me n u();s w i t c h(n){c a s e1:s u r e();b r e a k;c a s e2:de l();b r e a k;c a s e3:o p e n();b r e a k;}}w h i l e(n!=0)}实验总结:1.运用该程序可以顺利完成学生选课的添加、删除以及查询。
C语言学生管理系统课程设计报告总结1. 引言本报告总结了我们小组在C语言课程设计中开发的学生管理系统。
该系统旨在简化学校教务管理过程,提高教务工作效率,实现学生信息的快速查询、管理和统计。
本文将介绍系统的设计目标、主要功能模块以及我们在开发过程中遇到的挑战和解决方案。
2. 设计目标我们设计学生管理系统的主要目标是提供以下功能:•学生信息管理:包括学生基本信息的录入、查找、修改和删除操作。
•课程管理:包括课程信息的录入、查找、修改和删除操作。
•成绩管理:包括成绩录入、查询和统计功能。
•班级管理:包括班级信息的录入、查找、修改和删除操作。
3. 系统设计与实现3.1 数据结构设计为了存储学生信息、课程信息和成绩信息,我们设计了以下数据结构:•学生信息结构体:包含学生姓名、学号、性别、出生日期等字段。
•课程信息结构体:包含课程名称、课程号、学分等字段。
•成绩信息结构体:包含学生姓名、课程名称、分数等字段。
3.2 用户界面设计我们采用命令行界面来实现用户和系统的交互。
通过命令行菜单,用户可以选择不同的功能模块,并输入相应的命令进行操作。
我们通过C语言的输入输出函数来实现用户界面的显示和交互。
3.3 功能模块实现学生管理系统主要包含以下功能模块:•学生信息管理模块:实现学生信息的录入、查找、修改和删除操作。
•课程管理模块:实现课程信息的录入、查找、修改和删除操作。
•成绩管理模块:实现学生成绩的录入、查询和统计功能。
•班级管理模块:实现班级信息的录入、查找、修改和删除操作。
4. 开发过程中的挑战和解决方案在开发学生管理系统的过程中,我们遇到了以下挑战:1.数据存储和管理:如何有效地存储和管理大量的学生信息、课程信息和成绩信息。
我们采用了链表的数据结构来组织数据,通过指针进行关联和操作,以提高数据的访问效率。
2.用户界面设计:如何设计一个简洁、直观的用户界面,方便用户进行操作。
我们借鉴了其他类似系统的设计思路,采用了命令行菜单和命令交互的方式来实现用户界面,简化了用户操作的复杂性。
课程设计(论文)题目:学生选修课管理系统设计学生姓名:邓康言学号:20141409班级: 计软所在院部: 广西科技大学指导教师:2015 年6 月学生选修课管理系统设计学生选修课管理系统设计摘要C语言课程设计和现代计算机技术的实际应用相结合,是我们在本阶段学完理论课程之后对自己该方面的能力的一次很好的检验,从开始的算法思路到运行调试后的美观的图形界面以及另人兴奋的可用程序,都是一个很好的学习和锻炼的过程。
使我们巩固了原有的理论知识,培养了我们灵活运用和组合集成所学过知识及技能来分析、解决实际问题的能力。
使我们体会到自身知识和能力能在实际中的应用和发挥。
不但可以激发创新意识,还可以开发创造能力、培养沟通能力。
这次学生选修课系统管理设计时间虽然仅有一个星期,但确实使我受益非浅。
通过学生选修课系统管理设计我丰富了计算机操作经验,更加深了对C语言的了解,熟悉了其环境,更增强了对Microsoft Visual C++ 6.0的使用技巧。
C语言是在国内外广泛使用的一种计算机语言。
语言功能丰富、表达能力强、使用灵活方便、既具有高级语言的优点,又具有低级语言的许多特点,适合编写系统软件。
同时,我觉得C语言应该是操作和理论相结合的课程,在不断地编写中去思考,两者是不可分割的。
我们在编写一个较大的程序时应该把它分开成几个小程序来看,这样会容易得多。
关键词:学生选修课系统管理;C语言课程设计;计算机技术;模块化程序设计;信息录入;浏览信息;选课;查询STUDENTS ELECTIVE COURSES MANAGEMENT SYSTEMDESIGNABSTRACTC language curriculum design and modern computer technology in the practical application of the combination, we are at this stage of learning theory course on their own side of the ability of a good test, from the beginning of the algorithm to run after the beautiful graphical interface and exciting available procedures, is a very good learning and training process. We consolidate the original theory of knowledge, cultivate our flexible application and integration of the knowledge learned and skills of analysis, ability to solve practical problem. So that we realize that their knowledge and ability in practical application and play. Can not only stimulate consciousness of innovation, also can develop creative ability, communication skills training. The student elective system management design time although only a week, but it does make me benefit. Students elective system management design my rich experience in computer operation, more deep understanding of the C language, familiar with the environment, more increased to Microsoft Visual C++ 6 using skills.The C language is widely used at home and abroad a computer language. Language feature-rich, expressive capability is strong, flexible and convenient use, not only has the advantages of high-level language, but also has many of the characteristics of low-level language, suitable for the preparation of system software.At the same time, I think C language should be the operation of combining theory and curriculum, constantly writing to think, the two are inseparable. Us in the preparation of a larger process should divide it into several small procedures, it would be much easier.Key words:students elective system management; C language curriculum design; computer technology; modular design; information; information query; selection;目录1、需求分析 (1)2.1概要设计 (1)2.1模块设计及图示 (1)2.2主函数流程设计 (2)3 详细设计 (3)3.1程序中的数据类型 (3)3.2函数运行过程详解 (3)4、设计和调试分析 (13)4.1 调试中遇到的问题 (13)4.2 算法复杂度分析 (15)4.3 经验和体会 (15)5、用户使用说明 (16)6、测试数据和测试结果 (16)参考文献 (22)1 需求分析假定有N门课程,每门课程有课程编号,课程名称,课程性质,总学分,授课学时,实验上机学时,学分,开课学期等信息,学生可按要求(如总学分不得少于60)自由选课。
要求设计一选修课程系统,使之能提供以下功能:(1)课程信息录入功能(课程信息用文件保存)---------输入;(2)课程信息浏览功能------输出;(3)查询功能:(多种查询方式:一种、任意两种组合、三种都能满足)------算法;(1)按学分查询(2)按课程性质查询;(3)按课程名称查询;要求:(1)用C语言实现系统,源程序要有适当的注释,使程序容易阅读;(2)函数功能要划分好(结构化程序设计);(3)至少采用文本菜单界面(如果能采用图形菜单界面更好);(4)可以增加新功能模块2 概要设计本程序功能模块根据程序设计的需求,综4.0合程序的实用性、智能化得考虑,将程序划分为6个模块分别编写:2.1 五个模块分别为:(1)浏览课程信息模块(2)查询课程信息模块(3)进入系统进行选课模块 (4)选课情况统计模块 (5)录入选课信息模块2.2 主函数的流程设计:学生选课系统执行主流程如图所示,先执行主函数 按键的有效键值为0~5输入。
各个按键的执行功能为:“1”:浏览已录入的选修课课程信息调用函数,“2”:通过不同的方式查找记录,调用函数search(); “3”:进入系统进行选课,调用函数xuan_ke();“4”:查看课程已选情况,调用函数“5”:录入选修课信息,调用函数input(); “0”:退出系统;3 详细设计3.1 程序中定义的数据类型3.1、1 定义与课程有关的结构体struct course{int num; /*课程编号*/char name[20]; /*课程名称*/char kind[10]; /*课程性质*/int taltime,ttime,etime,mark,term; /*课程时间,学分,开课信息等*/};3.1.2 定义与学生有关的结构体struct student{int snum;/*学生学号*/int cnum;/*所选课程编号*/char cname[20];/*所选课程名称*/};3.2 每个函数的过程详解3.2.1 void f1();函数原型:void f1();函数源程序:void f1()/*常用函数2*/{printf("\n课程编号课程名称课程性质授课学时实验或上机学时总学时学分开课学期:\n");}函数功能及实现:此函数仅包含输出语句,在课程信息输出之前调用此函数,打印出表头信息3.2.2 void menu();函数原型:void menu()函数源程序:void menu()/*主菜单*/{Printf(“\n\n\n”);printf(" 欢迎使用学生选课系统!\n");printf("************************************** \n");printf(" * 1-浏览选课信息2-查询选课信息* \n");printf(" * 3-进入选课操作4-选课情况统计* \n");printf(" * 5-录入选课信息0-退出选课系统* \n");printf("************************************** \n");printf(" 请选择输入选项编号(请先选择5进行课程信息录入): ");}函数功能及实现:此函数为输出菜单,进入系统后提示可根据供选择的项目进行后续操作。
3.2.3 void browser();函数原型:void browser();函数源程序:/*浏览选课信息*/void browser(){FILE *fp;/*定义指向文件的指针*/struct course c;/*定义课程结构体变量c*/if((fp=fopen("course.txt","r"))==NULL){printf("\nCannot open course!\n");}f1();for(;!feof(fp);) /*直到文件结束*/{fscanf(fp,"%d %s %s %d %d %d %d %d\n",&c.num,&,&c.kind,&c.ttim e,&c.etime,&c.taltime,&c.mark,&c.term); /*将课程信息写入文件*/ printf("%5d%12s%9s%9d%12d%12d%8d%9d\n",c.num,,c.kind,c.ttime,c. etime,c.taltime,c.mark,c.term);/*格式化输出*/}fclose(fp);/*关闭文件*/menu();}函数功能及实现:此函数先定义指向文件的指针*fp,课程结构体变量c,通过if语句判断文件是否存在,在调用函数f1(),输出表头信息,通过for 循环并使用fscanf函数将文件中的课程信息读出并通过printf打印到屏幕上,再通过fclose函数关闭文件。