| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1814 人关注过本帖
标题:[求助]做一个c++的程序(学生管理系统)?
只看楼主 加入收藏
jerome7
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-6-19
收藏
 问题点数:0 回复次数:9 
[求助]做一个c++的程序(学生管理系统)?

1、功能要求

输入一个班级的学生基本信息(包括学号,姓名,性别,科目),对N门考试的成绩进行管理(例N=5)。

要求

1) 用户录入每个学生每门课程的分数;

2) 能够计算每个学生的各门功课总分和平均分,并按总分将成绩排序,显示每个学生的总分和名次;

3) 计算全班各门功课的平均分,显示每门课程中低于平均分的每一个学生的学号,姓名,性别,科目,成绩等信息。

4) 显示每门科目中,成绩在90分以上的学生信息,另外还输出每门科目中不及格的学生信息。

5) 能按姓名或者学号查找、增加、删除和保存各个学生的信息

搜索更多相关主题的帖子: 学生 系统 平均分 总分 
2006-06-21 15:38
jerome7
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-6-19
收藏
得分:0 
帮忙做一下,谢了
2006-06-21 16:06
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
自己写。。。。。。

I am a big fan of c plus plus.
2006-06-21 17:19
我爱编程
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-2-28
收藏
得分:0 
面想过程,用结构啊

2006-06-21 17:23
tianykun
Rank: 4
等 级:禁止访问
威 望:11
帖 子:3727
专家分:0
注 册:2005-11-13
收藏
得分:0 
以下是引用C++大粉丝在2006-6-21 17:19:06的发言:
自己写。。。。。。


离开这里,离开你的视野,归隐到属于我的地方,无论何处
2006-06-21 21:40
火蚂
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-5-19
收藏
得分:0 

#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"ctype.h"

#define N 3
#define Filename "student.txt"
typedef struct z1
{
char no[11];
char name[15];
float sum;
int score[N];
float average;
int order;
struct z1 *next;
}STUDENT;
STUDENT *init();
STUDENT *create(); /*创建链表*/
STUDENT *Delete(STUDENT *h); /*删除记录*/
void print(STUDENT *h); /*显示所有记录*/
void search(STUDENT *h); /*查找*/
void save(STUDENT *h); /*保存*/
STUDENT *load();
void computer(STUDENT *h);
STUDENT *insert(STUDENT *h);
STUDENT *amend(STUDENT *h);
void append(); /*追加记录*/
void copy(); /*复制文件*/
STUDENT *sort(STUDENT *h); /*排序*/
STUDENT *index(STUDENT *h); /*索引*/
int menu_select();
void main()
{
//int i;
STUDENT *head;
head=init();
//clrscr();
while(1)
{
switch(menu_select())
{
case 0:head=init();break;
case 1:head=create();break;
case 2:head=Delete(head);break;
case 3:print(head);break;
case 4:search(head);break;
case 5:save(head);break;
case 6:head=load();break;
case 7:computer(head);break;
case 8:head=insert(head);break;
case 9:amend(head);break;
case 10:head=sort(head);break;
case 11:append();break;
case 12:head=index(head);break;
case 13:return;
}
}
}
int menu_select()
{
char *menu[]={"\n************MENU***********", /*定义菜单字符*/
" 0.格式化当前信息",
" 1.输入学生信息",
" 2.删除学生信息",
" 3.打印当前数据库信息",
" 4.查询学生信息",
" 5.存盘",
" 6.读盘",
" 7.计算总成绩",
" 8.在当前数据添加学生信息",
" 9.修改学生信息",
" 10.学生成绩排序",
" 11.直接添加信息到数据库",
" 12.学生学号排序",
" 13.退出系统"
};
char s[3];
int c,i;

for(i=0;i<15;i++)
{
printf("%s",menu[i]);
printf("\n");
}

do{
printf("\n 请选择(0-13):");
scanf("%s",s);
c=atoi(s);
}while(c<0||c>14);
return c;
}
STUDENT *init()
{
return NULL;
}
STUDENT *create() /*创建链表*/
{
int i,s;
STUDENT *h=NULL,*info;
for(;;)
{
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\n out of memory");
return NULL;
}
printf("\n输入学号(以@符号结束):");scanf("%s",info->no);
if(info->no[0]=='@')break;
printf("输入姓名:");scanf("%s",info->name);
printf(" 输入%d门成绩 \n",N);
s=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i];
}
info->sum=s;
info->average=(float)s/N;
info->order=0;
info->next=h; /*将头节点作为新输入节点的后继节点*/
h=info;/*新输入节点为新的头节点 */
}
return(h);
}
void append()
{
FILE *fp;
STUDENT *info;
int s1,i;
printf("\n追加学生信息\n");
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\nout of memory");
return;
}
printf("输入学号:");scanf("%s",info->no);
printf("输入姓名:");scanf("%s",info->name);
printf("输入 %d 门成绩 \n",N);
s1=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];
}
info->sum=s1;
info->average=(float)s1/N;
info->order=NULL;
info->next=NULL;
if((fp=fopen(Filename,"ab"))==NULL)
{
printf("can not open file\n");
exit(1);
}
printf("\n----Appending record!-----");
if(1!=fwrite(info,sizeof(STUDENT),1,fp))
{
printf("----file write error!----\n");
return;
}
printf("----append sucess----\n");
fclose(fp);

}

STUDENT *insert(STUDENT *h)
{
STUDENT *p,*q,*info;
char s[11];
int s1,i;
printf("\n你希望在几号学生之前追加一条记录");
scanf("%s",s);
printf("\n添加记录");
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\nout of memory"); /*如果没有申请到,内存溢出*/
return NULL;
}
printf("\n输入学号:");scanf("%s",info->no) ;
printf("\n输入姓名:");scanf("%s",info->name);
printf("\n输入 %d门成绩\n",N);
s1=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];
}
info->sum=s1;
info->average=(float)s1/N;
info->order=0;
info->next=NULL;
p=h;
q=h;
while(strcmp(p->no,s)&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL)
if(p==h)
h=info;
else
q->next=info;
else
if(p==h)
{
info->next=p;
h=info;
}
else
{
info->next=p;
q->next=info;
}
printf("\n------Have Inserted %s Student-------\n",info->name);
printf("------Do Not Forger Save Disk!-------\n");

return(h);
}
STUDENT *index(STUDENT *h)
{
STUDENT *p,*q,*t,*h1;
h1=h->next;
h->next=NULL;
while(h1!=NULL)
{
t=h1;
h1=h1->next;
p=h;
q=h;
while(t->no!=p->no&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==q)
{
t->next=p;
h=t;
}
else
{
t->next=p;
q->next=t;
}
}
printf("index sucess!!!\n");

return h;
}
void computer(STUDENT *h)
{
STUDENT *p;
int j=0;
long s=0;
float average=0.;
p=h;
if(p==NULL)
{
printf("No Information");
return;
}
else
{
while(p!=NULL)
{
j++;
s+=p->sum;
p=p->next;
}
average=(float)s/j;
printf("\n所有学生总分:%d",s);
printf("\n平均分:%4.2f",average);
}
}

STUDENT *sort(STUDENT *h)
{
int i=0;
STUDENT *p,*q,*t,*h1;
h1=h->next;
h->next=NULL;
while(h1!=NULL)
{
t=h1;
h1=h1->next;
p=h;
q=h;
while(t->sum<p->sum&&p!=NULL)
{
q=p;
p=q->next;
}
if(p==q)
{
t->next=p;
h=t;
}
else
{
t->next=p;
q->next=t;
}
}
p=h;
while(p!=NULL)
{
i++;
p->order=i;
p=p->next;
}
printf("sort sucess!!!\n");
return h;
}

STUDENT *load()
{
STUDENT *p,*q,*h=NULL;
FILE *fp;
if((fp=fopen(Filename,"rb"))==NULL) /* 只读方式打开一个二进制文件 */
{
printf("Can't open file\n");
exit(1);
}
printf("\nLoading file... ....\n");
p=(STUDENT *)malloc(sizeof(STUDENT));
if(!p)
{
printf("out of memory!\n"); /* 内存溢出 */
return h;
}
h=p;
while(!feof(fp)) /* 循环至文件尾 */
{
if(1!=fread(p,sizeof(STUDENT),1,fp))
break;
p->next=(STUDENT *)malloc(sizeof(STUDENT));
if(!p->next)
{
printf("out of memory\n");
return h;
}
q=p;
p=p->next;
}
q->next=NULL;
fclose(fp);
printf("\n-----------Load File Success!!----------");

return h;
}
void save(STUDENT *h)
{
FILE *fp;
STUDENT *p;
if((fp=fopen(Filename,"wb"))==NULL) /* 输出打开一个二进制文件,没有则建立 */
{
printf("Can't open file\n");
return;
}
printf("\nSaving file... ...\n");
p=h;
while(p!=NULL)
{
fwrite(p,sizeof(STUDENT),1,fp);/*写入一条记录*/
p=p->next;
}
fclose(fp);
printf("--------Save Success!!-------");

}
void search(STUDENT *h)
{
STUDENT *p;
char s[15];
printf("please enter name for search\n");
scanf("%s",s);
p=h;
while(strcmp(p->name,s)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("\nList no %s student's information",s);
else
{
printf("\n\n\n--------------------------FOUND------------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %6.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("----------------------------END------------------------------\n");
}

}
void print(STUDENT *h)
{
int i=0;
STUDENT *p;

p=h;
printf("\n\n\n--------------------------STUDENT-----------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
while(p!=NULL)
{
i++;
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %6.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("----------------------------END------------------------------\n");
}
STUDENT *Delete(STUDENT *h)
{
STUDENT *p,*q;
char s[11],f[4];
printf("Please deleted no\n");
scanf("%s",s);
q=p=h;
while(strcmp(p->no,s)&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL)
{
printf("\nList No %s Student",s);
return(h);
}
else
{
printf("-------------------Have--------------Found------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("| | | | | | | | |\n");
printf("---------------------------------END-------------------------\n");
printf("press \"yes\" to be sure that you want to delete the student\n");
scanf("%s",f);
if(!strcmp(f,"yes")||!strcmp(f,"YES"))
{
if(p==h)
h=p->next;
else
q->next=p->next;
free(p);
printf("\nHave Deleted No %s Student\n",s);
printf("Don't Forget Save Disk!");
}
else
{
printf("Give Up delete!%s",f);
return(h);
}
}
return(h);
}
STUDENT *amend(STUDENT *h)
{
int i;
STUDENT *p;
char no[11];
printf("please the number of the student for amend\n");
scanf("%s",no);
p=h;
while(strcmp(p->no,no)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("\nList no NO.%s student's information",no);
else
{
printf("\n\n\n--------------------------FOUND------------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("----------------------------END------------------------------\n");
}
printf("\nNow please input the student's information again for amend");
printf("\nendter the number:"); scanf("%s",p->no);
printf("\nendter the name:"); scanf("%s",p->name);
p->sum=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&p->score[i]);
if(p->score[i]>100||p->score[i]<0)printf("bad date,input repeat");
} while(p->score[i]>100||p->score[i]<0);
p->sum+=p->score[i];
}
p->average=(float)p->sum/N;
return(h);

}

2006-06-22 17:27
火蚂
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-5-19
收藏
得分:0 

以上是用VC++做的,下面使用TC做的
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"conio.h"
#include"mem.h"
#include"ctype.h"
#include"alloc.h"
#define N 3
#define Filename "student.txt"
typedef struct z1
{
char no[11];
char name[15];
float sum;
int score[N];
float average;
int order;
struct z1 *next;
}STUDENT;
STUDENT *init();
STUDENT *create(); /*创建链表*/
STUDENT *delete(STUDENT *h); /*删除记录*/
void print(STUDENT *h); /*显示所有记录*/
void search(STUDENT *h); /*查找*/
void save(STUDENT *h); /*保存*/
STUDENT *load();
void computer(STUDENT *h);
STUDENT *insert(STUDENT *h);
STUDENT *amend(STUDENT *h);
void append(); /*追加记录*/
void copy(); /*复制文件*/
STUDENT *sort(STUDENT *h); /*排序*/
STUDENT *index(STUDENT *h); /*索引*/
int menu_select();
main()
{
int i;
STUDENT *head;
head=init();
clrscr();
for(;;)
{
switch(menu_select())
{
case 0:head=init();break;
case 1:head=create();break;
case 2:head=delete(head);break;
case 3:print(head);break;
case 4:search(head);break;
case 5:save(head);break;
case 6:head=load();break;
case 7:computer(head);break;
case 8:head=insert(head);break;
case 9:amend(head);break;
case 10:head=sort(head);break;
case 11:append();break;
case 12:head=index(head);break;
case 13:exit(0);
}
}
}
int menu_select()
{
char *menu[]={"************MENU***********", /*定义菜单字符*/
"\n",
"0.Init list",
"1.Enter list",
"2.Delete a record from list",
"3.Print list",
"4.Search record on name",
"5.Save the file",
"6.Load the file",
"7.Compute the score",
"8.Insert record to list",
"9.Amend information",
"10.Order the mark",
"11.Append new record to File",
"12.Index on nomber",
"13.Quit"
};
char s[3];
int c,i;
gotoxy(1,1);
/*printf("press any key enter menu...\n");*/
//getch();
clrscr();
gotoxy(1,1);
textcolor(YELLOW);
textbackground(BLUE);
gotoxy(10,2);
putch(0xc9);
for(i=1;i<44;i++)
putch(0xcd);
putch(0xbb);
for(i=3;i<20;i++)
{
gotoxy(10,i);putch(0xba);
gotoxy(54,i);putch(0xba);
}
gotoxy(10,20);putch(0xc8);
for(i=1;i<44;i++)
putch(0xcd);
putch(0xbc);
window(11,3,53,19);
clrscr();
for(i=0;i<16;i++)
{
gotoxy(10,i+1);
cprintf("%s",menu[i]);
}
textbackground(BLACK);
window(1,1,80,25);
gotoxy(10,21);
do{
printf("\n Enter your choice(0-13):");
scanf("%s",s);
c=atoi(s);
}while(c<0||c>14);
return c;
}
STUDENT *init()
{
return NULL;
}
STUDENT *create() /*创建链表*/
{
int i,s;
STUDENT *h=NULL,*info;
for(;;)
{
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\n out of memory");
return NULL;
}
printf("\nenter no:");scanf("%s",info->no);
if(info->no[0]=='@')break;
printf("enter name:");scanf("%s",info->name);
printf("please input %d score \n",N);
s=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i];
}
info->sum=s;
info->average=(float)s/N;
info->order=0;
info->next=h; /*将头节点作为新输入节点的后继节点*/
h=info;/*新输入节点为新的头节点 */
}
return(h);
}
void append()
{
FILE *fp;
STUDENT *info;
int s1,i;
char infile[10];
printf("\npress new record\n");
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\nout of memory");
return;
}
printf("enter no:");scanf("%s",info->no);
printf("enter name:");scanf("%s",info->name);
printf("please input %d score \n",N);
s1=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];
}
info->sum=s1;
info->average=(float)s1/N;
info->next=NULL;
if((fp=fopen(Filename,"ab"))==NULL)
{
printf("can not open file\n");
exit(1);
}
printf("\n----Appending record!-----");
if(1!=fwrite(info,sizeof(STUDENT),1,fp))
{
printf("----file write error!----\n");
return;
}
printf("----append sucess----\n");
fclose(fp);
getch();
}

STUDENT *insert(STUDENT *h)
{
STUDENT *p,*q,*info;
char s[11];
int s1,i;
printf("\nWhich number student do you want before?");
scanf("%s",s);
printf("\nenter the new record:");
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\nout of memory"); /*如果没有申请到,内存溢出*/
return NULL;
}
printf("\nenter no:");scanf("%s",info->no) ;
printf("enter name:");scanf("%s",info->name);
printf("please input %d score\n",N);
s1=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)printf("bad date,input repeat");
} while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];
}
info->sum=s1;
info->average=(float)s1/N;
info->order=0;
info->next=NULL;
p=h;
q=h;
while(strcmp(p->no,s)&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL)
if(p==h)
h=info;
else
q->next=info;
else
if(p==h)
{
info->next=p;
h=info;
}
else
{
info->next=p;
q->next=info;
}
printf("\n------Have Inserted %s Student-------\n",info->name);
printf("------Do Not Forger Save Disk!-------\n");
getch();
return(h);
}
STUDENT *index(STUDENT *h)
{
STUDENT *p,*q,*t,*h1;
h1=h->next;
h->next=NULL;
while(h1!=NULL)
{
t=h1;
h1=h1->next;
p=h;
q=h;
while(strcmp(t->no,p->no)>0&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==q)
{
t->next=p;
h=t;
}
else
{
t->next=p;
q->next=t;
}
}
printf("index sucess!!!\n");
getch();
return h;
}
void computer(STUDENT *h)
{
STUDENT *p;
int j=0;
long s=0;
float average=0.;
p=h;
if(p==NULL)
{
printf("No Information");
return;
}
else
{
while(p!=NULL)
{
j++;
s+=p->sum;
p=p->next;
}
average=(float)s/j;
printf("\nAll Student Sum Score is:%d",s);
printf("\nAverage Mark is:%4.2f",average);
}
getch();
}
STUDENT *sort(STUDENT *h)
{
int i=0;
STUDENT *p,*q,*t,*h1;
h1=h->next;
h->next=NULL;
while(h1!=NULL)
{
t=h1;
h1=h1->next;
p=h;
q=h;
while(t->sum<p->sum&&p!=NULL)
{
q=p;
p=q->next;
}
if(p==q)
{
t->next=p;
h=t;
}
else
{
t->next=p;
q->next=t;
}
}
p=h;
while(p!=NULL)
{
i++;
p->order=i;
p=p->next;
}
printf("sort sucess!!!\n");
getch();
return h;
}
STUDENT *load()
{
STUDENT *p,*q,*h=NULL;
FILE *fp;
if((fp=fopen(Filename,"rb"))==NULL) /* 只读方式打开一个二进制文件 */
{
printf("Can't open file\n");
exit(1);
}
printf("\nLoading file... ....\n");
p=(STUDENT *)malloc(sizeof(STUDENT));
if(!p)
{
printf("out of memory!\n"); /* 内存溢出 */
return h;
}
h=p;
while(!feof(fp)) /* 循环至文件尾 */
{
if(1!=fread(p,sizeof(STUDENT),1,fp))
break;
p->next=(STUDENT *)malloc(sizeof(STUDENT));
if(!p->next)
{
printf("out of memory\n");
return h;
}
q=p;
p=p->next;
}
q->next=NULL;
fclose(fp);
printf("\n-----------Load File Success!!----------");
getch();
return h;
}
void save(STUDENT *h)
{
FILE *fp;
STUDENT *p;
if((fp=fopen(Filename,"wb"))==NULL) /* 输出打开一个二进制文件,没有则建立 */
{
printf("Can't open file\n");
/* exit(1); */
}
printf("\nSaving file... ...\n");
p=h;
while(p!=NULL)
{
fwrite(p,sizeof(STUDENT),1,fp);/*写入一条记录*/
p=p->next;
}
fclose(fp);
printf("--------Save Success!!-------");
getch();
}
void search(STUDENT *h)
{
STUDENT *p;
char s[15];
clrscr();
printf("please enter name for search\n");
scanf("%s",s);
p=h;
while(strcmp(p->name,s)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("\nList no %s student's information",s);
else
{
printf("\n\n\n--------------------------FOUND------------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("----------------------------END------------------------------\n");
}
getch();
}
void print(STUDENT *h)
{
int i=0;
STUDENT *p;
clrscr();
p=h;
printf("\n\n\n--------------------------STUDENT----------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
while(p!=NULL)
{
i++;
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("----------------------------END------------------------------\n");
getch();
}
STUDENT *delete(STUDENT *h)
{
STUDENT *p,*q;
char s[11],f[4];
clrscr();
printf("Please deleted no\n");
scanf("%s",s);
q=p=h;
while(strcmp(p->no,s)&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL)
printf("\nList No %s Student",s);
else
{
printf("-------------------Have--------------Found------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("| | | | | | | | |\n");
printf("---------------------------------END-------------------------\n");
printf("press \"yes\" to be sure that you want to delete the student\n");
scanf("%s",f);
if(!strcmp("yes",f))
{
if(p==h)
h=p->next;
else
q->next=p->next;
free(p);
printf("\nHave Deleted No %s Student\n",s);
printf("Don't Forget Save Disk!");
}
else
{
printf("Give Up delete!%s",f);
return(h);
}
}
getch();
return(h);
}
STUDENT *amend(STUDENT *h)
{
int i;
STUDENT *p;
char no[11];
clrscr();
printf("please the number of the student for amend\n");
scanf("%s",no);
p=h;
while(strcmp(p->no,no)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("\nList no NO.%s student's information",no);
else
{
printf("\n\n\n--------------------------FOUND------------------------------\n");
printf("| no | name | sc1| sc2| sc3| sum | ave | order |\n");
printf("| | | | | | | | |\n");
printf("|%7s|%12s|%4d|%4d|%4d| %6.2f| %5.2f|%7d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("----------------------------END------------------------------\n");
}
printf("\nNow please input the student's information again for amend");
printf("\nendter the number:"); scanf("%s",p->no);
printf("\nendter the name:"); scanf("%s",p->name);
p->sum=0;
for(i=0;i<N;i++)
{
do
{
printf("score%d:",i+1);
scanf("%d",&p->score[i]);
if(p->score[i]>100||p->score[i]<0)printf("bad date,input repeat");
} while(p->score[i]>100||p->score[i]<0);
p->sum+=p->score[i];
}
p->average=(float)p->sum/N;getch();
return(h);

}

2006-06-22 17:30
trainche
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-8-4
收藏
得分:0 

帮忙谢谢了

2006-06-25 23:49
jaylaiming
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-12-24
收藏
得分:0 
插入学生信息没有结束的?
2011-12-25 13:17
夏至未至默默
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-6-20
收藏
得分:0 
好厉害
2013-06-20 21:42
快速回复:[求助]做一个c++的程序(学生管理系统)?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027201 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved