C语言程序设计报告学生选修课系统Word下载.docx

上传人:b****0 文档编号:13263087 上传时间:2022-10-09 格式:DOCX 页数:16 大小:17.51KB
下载 相关 举报
C语言程序设计报告学生选修课系统Word下载.docx_第1页
第1页 / 共16页
C语言程序设计报告学生选修课系统Word下载.docx_第2页
第2页 / 共16页
C语言程序设计报告学生选修课系统Word下载.docx_第3页
第3页 / 共16页
C语言程序设计报告学生选修课系统Word下载.docx_第4页
第4页 / 共16页
C语言程序设计报告学生选修课系统Word下载.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

C语言程序设计报告学生选修课系统Word下载.docx

《C语言程序设计报告学生选修课系统Word下载.docx》由会员分享,可在线阅读,更多相关《C语言程序设计报告学生选修课系统Word下载.docx(16页珍藏版)》请在冰豆网上搜索。

C语言程序设计报告学生选修课系统Word下载.docx

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>

开始typedefstructsubjects{

intnum;

显示一系列功能选择charname[20];

charkind[10];

intstime;

N

判断intttime;

intetime;

intscore;

intterm;

结束structsubjects*next;

}SUB;

SUB*create_form()

{

SUB*head,*tail,*p;

intnum,stime,ttime;

intetime,score,term;

charname[20],kind[10];

intsize=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);

kind,kind);

stime=stime;

ttime=ttime;

etime=etime;

score=score;

term=term;

if(head==NULL)

head=p;

else

tail->

next=p;

tail=p;

}

next=NULL;

returnhead;

}

voidsavefile(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->

fclose(fp);

voidsavefileadd(SUB*head)

SUB*p;

FILE*fp;

fp=fopen(subjectsadd.txt,w);

灦楲瑮?

voidsavefiledel(SUB*head)

fp=fopen(subjectsdel.txt,w);

voidprin(SUB*head)

SUB*ptr;

if(head==NULL){

牰湩晴尨没有此门课程记录!

return;

牰湩晴尨课程编号课程名称课程性质总学时授课学时实践或上机学时学分开课学期\n);

for(ptr=head;

ptr;

ptr=ptr->

printf(]_x0012_s%9s?

dd}\n,ptr->

num,ptr->

name,ptr->

kind,ptr->

stime,ptr->

ttime,ptr->

etime,ptr->

score,ptr->

voidsearch(SUB*head)开始{

inta,num;

打开文件查看学生选课信息intt=1;

chartype[10];

charch='

a'

ch1;

2

1

SUB*ptr;

判断查询方法

查分学按质性按课程输入

结束while(ch!

='

'

){

2:

输入分查找请1程要按课性质查找请输入,若要按学若牰湩晴尨scanf(%d,&

a);

switch(a){

:

的性质入慣敳ㄠ瀺楲瑮?

请输要查找的课程scanf(%s,type);

或实践学程称名课性质总学时授课时程号程牰湩晴尨课编课\n);

学分学期开课时机上学

for(ptr=head;

if(strcmp(type,ptr->

kind)==0){

t=0;

晩琨?

牰湩晴尨未找到!

t=1;

break;

慣敳㈠瀺楲瑮?

输入要查找的课程的学分\n);

scanf(%d,&

num);

if(ptr->

score==num){

牰湩晴尨继续查找请按回车键,结束请按空格键:

ch1=getchar();

//将回车键赋给CH1,否则CASE里面最后输入的回车键会赋给CH,因此用CH1填补。

ch=getchar();

SUB*insert(SUB*head)

SUB*ptr,*ptr2,*subj;

intsize=sizeof(SUB);

charch='

while(ch!

subj=(SUB*)malloc(size);

ptr=subj;

牰湩晴尨输入要插入的课程信息:

scanf(%d%s%s%d%d%d%d%d,&

subj->

num,subj->

name,subj->

if(head==NULL){

head=ptr;

head->

else{

for(ptr2=head;

ptr2;

ptr2=ptr2->

if(ptr2->

next==NULL){

ptr2->

next=subj;

subj->

牰湩晴尨继续插入请按回车,结束请按空格:

//将回车键赋给CH1,否则subj->

term输完后输入的回车键会赋给CH,因此用CH1填补。

SUB*del(SUB*head)

SUB*p1,*p2;

intnum;

牰湩晴尨输入想要删除的课程编号:

if(head->

num==num){

p2=head;

head=head->

next;

free(p2);

returnNULL;

p1=head;

p2=head->

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 判决书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1