预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共21页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

.#include<stdio.h>#include<stdlib.h>#include<string.h>intN1N2;structstudent{intnum2;charname2[20];intnelenum[50];//所选课程编号intnelen;//所选课程学分和structstudent*next;};structcourse{intnum1;//课程编号charname1[20];charmajor[20];chartype[20];intcredit;intperiod;charteacher[20];intpeople;//选此门课程的人数structcourse*next;//结构体指针};structcourse*head1;structstudent*head2;voidzhang<>//从键盘录入课程信息{structcourse*p1*p2;N1=0;p1=p2=<structcourse*>malloc<sizeof<structcourse>>;1/21.printf<"课程编号\t课程名称\t主修\t课程性质\t学分\t课时\t教师\n">;scanf<"%d%s%s%s%d%d%s"&p1->num1p1->name1p1->majorp1->type&p1->credit&p1->periodp1->teacher>;p1->people=0;head1=NULL;while<p1->num1!=0>{N1=N1+1;if<N1==1>head1=p1;elsep2->next=p1;p2=p1;p1=<structcourse*>malloc<sizeof<structcourse>>;scanf<"%d%s%s%s%d%d%s"&p1->num1p1->name1p1->majorp1->type&p1->credit&p1->periodp1->teacher>;p1->people=0;}p2->next=NULL;}voidzhang1<>//从文件录入课程信息{FILE*fp;charfilepath[20];structcourse*p1*p2;N1=0;printf<"请输入您要读取的路径:">;getchar<>;gets<filepath>;if<<fp=fopen<filepath"r">>==NULL>2/21.{printf<"找不到%s文件!\n"filepath>;exit<0>;}p1=p2=<structcourse*>malloc<sizeof<structcourse>>;fscanf<fp"%d%s%s%s%d%d%s%d"&p1->num1p1->name1p1->majorp1->type&p1->credit&p1->periodp1->teacher&p1->people>;while<!feof<fp>>{N1=N1+1;if<N1==1>head1=p1;elsep2->next=p1;p2=p1;p1=<structcourse*>malloc<sizeof<structcourse>>;fscanf<fp"%d%s%s%s%d%d%s%d"&p1->num1p1->name1p1->majorp1->type&p1->credit&p1->periodp1->teacher&p1->people>;}p2->next=NULL;}voidload<>