最新学生信息管理系统C语言实现.docx
《最新学生信息管理系统C语言实现.docx》由会员分享,可在线阅读,更多相关《最新学生信息管理系统C语言实现.docx(20页珍藏版)》请在冰豆网上搜索。
最新学生信息管理系统C语言实现
#include
#include
#include
intinput(structstudcode**);//输入学生信息的函数
voidinstruct(void);//打印提示信息
voidpicture();//制表函数
voidoutput(structstudcode*);//输出函数
voidsearch(structstudcode*);//查找信息函数
intincrease(structstudcode*);//增加学生信息的函数
voiddele(structstudcode**);//删除学生记录的函数
voidprintall(structstudcode*);//输出全部学生信息的函数
voidaverage(structstudcode*headp,structanalysis**head);//统计各科目平均分
intsort(structanalysis**head);//排序函数(升序排列)
voiddate_load(structstudcode**headp);//程序开始载入信息
voiddate_save(structstudcode*headp);//程序结束保存数据
structanalysis
{
charname_ex[20];//实验名称
intnumber;//统计到课人数
floataver;//平均分
structanalysis*next;
};
structstudent
{
charname_tea[20];//教师名字
charname_stu[20];//学生名字
charclas[20];//班级
charname_ex[20];//实验名称
floatmatch;//分数
};
structstudcode
{
structstudentdate;
structstudcode*next;//建立链表的指针
};
intmain()
{
charchoose;
structstudcode*head=NULL;
structanalysis*head1=NULL;
//date_load(&head);
instruct();
printf("\n请选择功能:
");
choose=getchar();
while(choose!
='0')//输入0结束程序
{
switch(choose)
{
case'1':
input(&head);//建立链表
getchar();
getchar();
break;
case'2':
search(head);//查找信息
getchar();
getchar();
break;
case'3':
dele(&head);//删除信息
getchar();
getchar();
break;
case'4':
increase(head);//增加信息
getchar();
getchar();
break;
case'5':
printall(head);//输出全部信息
getchar();
getchar();
break;
case'6':
average(head,&head1);//统计各科平均分并升序输出
getchar();
getchar();
break;
default:
printf("\n选择错误,重选\n");
}
instruct();
printf("\n请选择功能:
");
choose=getchar();
}
system("cls");
date_save(head);
printf("谢谢使用本系统\n");
return0;
}
voidinstruct(void)
{
system("cls");
printf("\n\t\t\t试验管理系统\t\t\t\t");
printf("\n\t\t\t1建立学生信息链表\t\t\t\t");
printf("\n\t\t\t2搜索学生相关信息\t\t\t\t");
printf("\n\t\t\t3删除某个学生信息\t\t\t\t");
printf("\n\t\t\t4增加某个学生信息\t\t\t\t");
printf("\n\t\t\t5输出链表全部信息\t\t\t\t");
printf("\n\t\t\t6统计各科目平均分\t\t\t\t");
printf("\n\t\t\t0退出程序\t\t\t\t");
}
intinput(structstudcode**headp)
{
structstudcode*p,*tail;
chara[4];
system("cls");
date_load(headp);
if(*headp!
=NULL)
{
printf("链表信息载入成功");
return1;
}
else
{
printf("目前没有数据保存请从终端输入数据");
}
printf("\n\t\t\t成绩输入功能\t\t\t\t");
p=(structstudcode*)malloc(sizeof(structstudcode));
if(p==NULL)
{
printf("error");
exit(-1);
}
printf("\n请按提示输入相关信息");
printf("\n教师姓名:
");
scanf("%s",p->date.name_tea);
printf("学生姓名:
");
scanf("%s",p->date.name_stu);
printf("学生班级:
");
scanf("%s",p->date.clas);
printf("实验名称:
");
scanf("%s",p->date.name_ex);
printf("评分:
");
scanf("%f",&p->date.match);
p->next=*headp;
*headp=p;
tail=p;
printf("是否继续输入输入NO退回主菜单其他任意字符继续当前操作\\\\");
scanf("%s",a);
while(strcmp(a,"NO")!
=0)
{
system("cls");
printf("\n\t\t\t成绩输入功能\t\t\t\t");
p=(structstudcode*)malloc(sizeof(structstudcode));
if(p==NULL)
{
printf("error");
exit(-1);
}
printf("\n教师姓名:
");
scanf("%s",p->date.name_tea);
printf("学生姓名:
");
scanf("%s",p->date.name_stu);
printf("学生班级:
");
scanf("%s",p->date.clas);
printf("实验名称:
");
scanf("%s",p->date.name_ex);
printf("评分:
");
scanf("%f",&p->date.match);
p->next=NULL;
tail->next=p;
tail=p;
printf("是否继续输入输入NO退回主菜单其他任意字符继续当前操作\\\\");
scanf("%s",a);
}
return1;
}
voidsearch(structstudcode*headp)
{
intflag=1;
chara[2][20],b[4]="YES";
structstudcode*p;
system("cls");
printf("\n┃\t\t\t成绩查询功能\t\t\t\t");
while(!
strcmp(b,"YES"))
{
p=headp;
printf("\n学生姓名:
");
scanf("%s",a[0]);
printf("实验名称:
");
scanf("%s",a[1]);
for(;p!
=NULL;p=p->next)
{
flag=1;
if(strcmp(a[0],p->date.name_stu)==0&&strcmp(a[1],p->date.name_ex)==0)
{
flag=0;
picture();
output(p);
break;
}
}
if(flag==1)
{
printf("\n请确认您输入的姓名或者实验名称是否正确");
}
printf("\n是否要继续使用该功能YES/NO\\\\");
scanf("%s",b);
system("cls");
printf("\n\t\t\t成绩查询功能\t\t\t\t");
}
}
voidpicture()
{
printf("\t\t\t实验成绩表");
printf("\n教师姓名学生姓名学生班级实验名称实验成绩");
}
voidoutput(structstudcode*p)
{
printf("\n%14s%13s%8s%19s%8.2f",p->date.name_tea,p->date.name_stu,p->date.clas,p->date.name_ex,p->date.match);
}
voiddele(structstudcode**headp)
{
structstudcode*p,*last;
chara[20],b[20],c[5]="YES";
system("cls");
while(strcmp(c,"YES")==0)
{
printf("学生姓名");
scanf("%s",a);
printf("实验名称");
scanf("%s",b);
p=*headp;
while(strcmp(a,p->date.name_stu)!
=0&&strcmp(b,p->date.name_ex)!
=0&&p->next!
=NULL)
{
last=p;
p=p->next;
}
if(strcmp(a,p->date.name_stu)==0&&strcmp(b,p->date.name_ex)==0)
{
if(p==*headp)
*headp=p->next;
else
last->next=p->next;
free(p);
}
else
{
printf("请确认您输入的姓名或者实验名称是否正确");
}
printf("输入YES继续使用该功能,输入其他任意字符退回主菜单\\\\");
scanf("%s",c);
system("cls");
}
}
voidprintall(structstudcode*headp)
{
chara[5];
system("cls");
picture();
if(headp!
=NULL)
{
output(headp);
headp=headp->next;
}
while(headp!
=NULL)
{
output(headp);
headp=headp->next;
}
printf("\n输入back返回主菜单");
while(strcmp(a,"back")!
=0)
scanf("%s",a);
}
voidaverage(structstudcode*headp,structanalysis**head)
{
chara[5];
structanalysis*p=*head;
system("cls");
if(headp==NULL)
{
printf("请先建立链表");
exit(-1);
}
p=*head;
while(p!
=NULL)
{
p->aver=0;
p=p->next;
}
p=*head;
while(headp!
=NULL)
{
while(strcmp(headp->date.name_ex,p->name_ex)!
=0)
{
p=p->next;
}
p->aver+=headp->date.match;
p=*head;
headp=headp->next;
}
while(p!
=NULL)
{
p->aver/=p->number;
p=p->next;
}
p=*head;
sort(head);//求出平均值后排序
while(p!
=NULL)
{
printf("%s平均分为%f\n",p->name_ex,p->aver);
p=p->next;
}
printf("输入back退回主菜单");
scanf("%s",a);
while(strcmp(a,"back"))
{
scanf("%s",a);
}
}
intsort(structanalysis**head)
{
intn=0,i,m,temp1;
floattemp2;
structanalysis*p,*j;
chartemp3[20];
p=*head;
j=p->next;
if(j==NULL)
return0;//如果只有一个科目的数据则不排序
while(p!
=NULL)//统计有几个科目,作为下面冒泡排序控制条件的依据
{
n+=1;
p=p->next;
}
p=*head;
for(i=0;ifor(m=0,j=p->next;m{
if(p->aver>j->aver)//排序时直接交换各节点数据
{
strcpy(temp3,p->name_ex);//交换实验名称
strcpy(p->name_ex,j->name_ex);
strcpy(j->name_ex,temp3);
temp1=p->number;//交换到课人数
p->number=j->number;
j->number=temp1;
temp2=p->aver;
p->aver=j->aver;
j->aver=temp2;
}
p=j;
j=j->next;
}
return1;
}
voiddate_load(structstudcode**headp)
{
charch;
FILE*f;
structstudcode*p,*tail;
if((f=fopen("e:
\\input.txt","a+"))==NULL)
{
printf("error");
exit(0);
}
ch=fgetc(f);//读取第一个空格,控制格式
if(ch!
=EOF)//如果文件中有保存的信息则读取
{
if((p=(structstudcode*)malloc(sizeof(structstudcode)))==NULL)
{
printf("error");
exit(0);
}
fscanf(f,"%s%s%s%s%f\n",p->date.name_tea,p->date.name_stu,p->date.clas,p->date.name_ex,&p->date.match);
p->next=NULL;
*headp=p;
tail=p;
while(!
feof(f))
{
if((p=(structstudcode*)malloc(sizeof(structstudcode)))==NULL)
{
printf("error");
exit(0);
}
fscanf(f,"%s%s%s%s%f\n",p->date.name_tea,p->date.name_stu,p->date.clas,p->date.name_ex,&p->date.match);
p->next=NULL;
tail->next=p;
tail=p;
}
}
fclose(f);
}
voiddate_save(structstudcode*headp)
{
FILE*f;
structstudcode*p;
inti;
printf("是否要更新原有数据。
输入1进行更新,其他数字跳过更新步骤:
");
scanf("%d",&i);
if(i==1)//跟新数据的模块
{
if((f=fopen("e:
\\input.txt","w"))==NULL)
{
printf("error");
exit(0);
}
p=headp;
while(p!
=NULL)
{
fprintf(f,"%s%s%s%s%f\n",p->date.name_tea,p->date.name_stu,p->date.clas,p->date.name_ex,p->date.match);
p=p->next;
}
fclose(f);
}
}
intincrease(structstudcode*headp)
{
chara[4]="YES";
structstudcode*p;
system("cls");
if(headp==NULL)
{
printf("请先创建链表");
return1;
}
while(headp->next!
=NULL)
headp=headp->next;
while(strcmp(a,"YES")==0)
{
if((p=(structstudcode*)malloc(sizeof(structstudcode)))==NULL)
{
printf("error");
exit
(1);
(二)创业弱势分析}
printf("教师姓名:
");
scanf("%s",p->date.name_tea);
(二)DIY手工艺品的“热卖化”printf("学生姓名:
");
1、荣晓华、孙喜林《消费者行为学》东北财经大学出版社2003年2月scanf("%s",p->date.name_stu);
printf("学生班级:
");
scanf("%s",p->date.clas);
而手工艺制品是一种价格适中,不仅能锻炼同学们的动手能力,同时在制作过程中也能体会一下我国传统工艺的文化。
无论是送给朋友还是亲人都能让人体会到一份浓厚的情谊。
它的价值是不用金钱去估价而是用你一颗真诚而又温暖的心去体会的。
更能让学生家长所接受。
printf("实验名称:
");
scanf("%s",p->date.name_ex);
他们的成功秘诀在于“连锁”二字。
凭借“连锁”,他们在女孩们所喜欢的小玩意上玩出了大名堂。
小店连锁,优势明显,主要有:
printf("评分:
");
scanf("%f",&p->date.match);
p->next=NULL;
headp->next=p;
营销调研课题headp=p;
printf("是否继续增加记录输入YES继续增加,输入其他任意字符退回主菜单");
送人□有实用价值□装饰□scanf("%s",a);
system("cls");
}
因为是连锁店,老板的“野心”是开到便利店那样随处可见。
所以办了积分卡,方便女孩子到任何一家“漂亮女生”购物,以求便宜再便宜。
return1;
}
3.www。
oh/ov。
com/teach/student/shougong/
1996年“碧芝自制饰品店”在迪美购物中心开张,这里地理位置十分优越,交通四通八达,由于位于市中心,汇集了来自各地的游客和时尚人群,不用担心客流量的问题。
迪美有300多家商铺,不包括柜台,现在这个商铺的位置还是比较合适的,位于中心地带,左边出口的自动扶梯直接通向地面,从正对着的旋转式楼梯阶而上就是人民广场中央,周边4、5条地下通道都交汇于此,从自家店铺门口经过的90%的顾客会因为好奇而进去看一下。