C语言大型作业实践报告
计算机1001
制作者:
20##年6月
题目:选修课程管理系统
要求:假定有N门选修课,每门课有课程编号、名称、课程性质、总学时、授课学时、实验或上机学时、学分、开课学期等信息。学生可按要求(如总学分不能少于20学分)选课。
具体算法流程设计思路(流程图):
程序源代码:
#include
#include
#include
#include
main()
{
int x,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("wrong choice!!!");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 this system");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
{
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 choice!!!Please 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("2.name 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;}
else
if(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(choice30)
{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
{
electivedata[xi].students=0;
fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenum,electivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalclassnum,electivedata[xi].techclassnum,electivedata[xi].expclassnum,electivedata[xi].credits,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
{
fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].totalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electivedata[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
{
for(e=0;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
{
fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].totalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electivedata[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
{
gotoxy(5,u+3);
cprintf("%d.num:%d name:%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
{
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].electivenum;
studentcare[stui].mutichoice[stuc].stuclassname=electivedata[choice4-1].electivename;
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("wrong choice!!!");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
{
fprintf(stufp,"%s %ld %d \n",studentcare[u].stuname,studentcare[u].stunum,studentcare[u].stucredits);
for(xi=0;xi
{
fprintf(stufp,"%d %d %s \n",studentcare[u].mutichoice[xi].stuchoice,studentcare[u].mutichoice[xi].stuclassnum,studentcare[u].mutichoice[xi].stuclassname);
}
}
remove("elective.dat");
electivefp=fopen("elective.dat","w+");
fprintf(electivefp,"%d \n",x);
for(xi=0;xi
{
fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenum,electivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalclassnum,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
{
fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].totalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electivedata[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);
}
system("cls");
gotoxy(3,4);
cprintf("Elective toll");
for(u=0;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
{
fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].totalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electivedata[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);
}
outfp=fopen("electiveinformation.doc","w+");
fprintf(outfp,"选修课程信息\n\n\n\n");
for(xi=0;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,electivedata[xi].electivekind,electivedata[xi].totalclassnum,electivedata[xi].techclassnum,electivedata[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
{
fscanf(find,"%d %s %s %d %d %d %d %d %d\n",&electivedata[i].electivenum,&electivedata[i].electivename,&electivedata[i].electivekind,&electivedata[i].totalclassnum,&electivedata[i].techclassnum,&electivedata[i].expclassnum,&electivedata[i].credits,&electivedata[i].classterm,&electivedata[i].students);
}
xx:io=0;
system("cls");
gotoxy(7,3);
printf("a:search by electivenum;\n b:search by electivename;\n c: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("wrong choice\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
{
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
{
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
{
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
{
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
{
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);
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;}
f:screen=0;
{system("cls");gotoxy(24,12);
cprintf("Please write down the expclassnum\n");gotoxy(24,13);
scanf("%d",&ecnum);system("cls");
for(i=0; i
{
if(electivedata[i].credits==ecnum)
{
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;}
g:screen=0;
{system("cls");gotoxy(24,12);
cprintf("Please write down the credits\n");gotoxy(24,13);
scanf("%d",&score);system("cls");
for(i=0; i
{
if(electivedata[i].credits==score)
{
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;}
h:screen=0;
{system("cls");gotoxy(24,12);
cprintf("Please write down the term\n");gotoxy(24,13);
scanf("%d",&term);
system("cls");
for(i=0; i
{
if(electivedata[i].classterm==term)
{
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;}
i:screen=0;
{system("cls");gotoxy(24,12);
cprintf("Please write down the students\n");gotoxy(24,13);
scanf("%d",&student);system("cls");
for(i=0; i
{
if(electivedata[i].students==student)
{
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 t2;
}
x5:system("pause");
}
密码钥匙程序源代码:
#include
#include
main()
{
long now,midkey;
unsigned long password;
char R=82;
char a;
struct tm *timenow;
q1:system("cls");
time(&now);
midkey=now;
midkey=midkey/100;
password=midkey;
gotoxy(20,12);
printf("Now,the key is %ld",password);
gotoxy(2,15);
printf("Enter R to refresh the key\n\n\n\n\n\n\n\n");
scanf("%c",&a);
if(a==R)
{goto q1;}
system("pause");
}
C语言课程设计报告一问题描述题目七学生成绩管理系统设计学生成绩信息包括学期学号班别姓名四门课程成绩语文数学英语和计算机等主要功能1…
移通学院C语言程序设计报告书设计名称学生成绩管理系统专业指导老师班级姓名学号座号时间一实验目的1在编辑应用程序过程中逐步加深对C语…
XX大学CSUC语言程序设计实践报告学生姓名剽悍的小白兔指导教师TZ学院信息科学与工程学院专业班级电气信息类XXXX班完成时间20…
内蒙古科技大学课程设计论文内蒙古科技大学本科生课程设计论文题目学生成绩管理系统学生姓名胡书培学号1067111106专业计算机科学…
学生成绩管理系统课程设计报告书学生成绩管理系统单位分院班级学号姓名指导老师完成日期20xx年7月14日1学生成绩管理系统内容摘要摘…
学生选课系统报告书目录第一章摘要关键词2第二章课程设计任务内容与思路3第三章程序功能划分及流程图第四章程序运行结果第五章设计心得第…
C语言程序设计学校:学院:班级序号:学号:指导老师:C语言程序设计报告一、C语言课程设计的目的:高级语言课程设计是学习完《高级语言…
武夷学院课程设计报告课程名称设计题目学生班级学生姓名指导教师完成日期C语言程序设计学生选课管理系统20xx级计算机科学与技术2班2…
学生选课系统概要设计报告班级网络102班姓名张宇飞08103639王籽硕081036311引言11编写目的学生选课系统可对学生信息…
兰州理工大学计算机与通信学院20XX年春季学期C程序设计课程设计题目:学生选课系统专业班级:通信工程1班姓名:学号:指导教师:XX…
计算机与信息技术学院综合性实验报告一实验目的利用所学的UML建模知识设计学生信息管理系统由于信息技术的急剧发展和配合管理的思想的出…