用c语言制作学生档案管理系统 20

要求对学生的信息进行修改。这要求必须是管理人员才可能修改,或是添加新学生的信息,对学生的信息包括学生的学号,姓名,年龄,性别,家庭住址,和学生的一些基本信息... 要求对学生的信息进行修改。这要求必须是管理人员才可能修改,或是添加新学生的信息,对学生的信息包括学生的学号,姓名,年龄,性别,家庭住址,和学生的一些基本信息 展开
 我来答
zuec
2006-08-26 · TA获得超过244个赞
知道小有建树答主
回答量:419
采纳率:0%
帮助的人:309万
展开全部
我以前做的
给你了
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct student
{char name[30];
char number[20];
char sex[10];
char nation[10];
char address[60];
char born[20];
char family[60];
char course[60];
int sign;
struct student *next;
}record;
struct student *head;
static int n;
int menu_select(),i;
void enter();
void delete();
void search();
void group();
void change();
void savefile();
void openfile();
main()
{char s[80],choice;
head=NULL;
for(;;)
switch(menu_select())
{case 1:enter();break;
case 2:delete();break;
case 3:search();break;
case 4:change();break;
case 5:group();break;
case 6:savefile();break;
case 7:openfile();break;
case 8:exit(0);
}
}
void group()
{struct student *p,*p1;
int j=1;
p1=head;
printf("\nyou can know every student's main information from this\n");
do
{printf("Sign number:%4d. Name:%10s. Number:%8s. Sex:%4s. Nation:%4s. Born:%6s\n",p1->sign,p1->name,p1->number,p1->sex,p1->nation,p1->born);
p1=p1->next;j++;
}while(p1->name!=0);
}

int menu_select()
{char s[80];
int n;
printf("1----Enter a name\n");
printf("2----Delete arecord\n");
printf("3----Search\n");
printf("4----Change\n");
printf("5----Group\n");
printf("6----savefile\n");
printf("7----openfile\n");
printf("8----Quit\n");
do
{printf("please input you choice:\n");
gets(s);
n=atoi(s);
}
while(n<1||n>8);
return(n);
}
void enter()
{struct student *info;
void circle();
float a;
for(n=0;;n++)
{info=(struct student *)malloc(sizeof(record));
if(info==NULL)
{printf("\n Out of memory");
return;
}
getchar();
printf("enter name:");
gets(info->name);
if(info->name[0]=='0')
{info->next=0;break; }
else
{
printf("enter number:");
gets(info->number);
printf("enter Sex:");
gets(info->sex);
printf("enter nation:");
gets(info->nation);
printf("enter Address:");
gets(info->address);
printf("enter Born date:");
gets(info->born);
printf("enter Family:");
gets(info->family);
printf("enter Course:");
gets(info->course);
printf("enter Sign number:");
scanf("%d",&info->sign);
circle(info);
}
}
}
void circle(struct student *info)
{ struct student *p2,*p1,*p0;
p1=head;
p0=info;
if(head==NULL)
{head=p0;p0->next=NULL;}
else
{while((p0->sign<p1->sign)&&(p1->next!=NULL))
{p2=p1;
p1=p1->next;}
if(p0->sign>p1->sign)
{if(head==p1)head=p0;
else p2->next=p0;
p0->next=p1;}
else
{p1->next=p0;p0->next=NULL;}
}
}

void display(info)
struct student *info;
{printf("Name:%s\n",info->name);
printf("Number:%s\n",info->number);
printf("Sex:%s\n",info->sex);
printf("Nation:%s\n",info->nation);
printf("Address:%s\n",info->address);
printf("Born date:%s\n",info->born);
printf("Family:%s\n",info->family);
printf("Course:%s\n",info->course);
printf("Sign number:%d\n",info->sign);
printf("\n\n");
}
void search()
{char name[40],street[30],s[30],t[30];
struct student *info,*find();
printf("you want by what to find name? number? sign(_number)?");
gets(t);
printf("\n input please:");
gets(s);
if((info=find(s))==NULL)
printf("not found\n");
else display(info);
}
struct student *find(char *s)
{
struct student *info;
info=head;
while(info)
{if((!strcmp(s,info->name))||(!strcmp(s,info->number))||(!strcmp(s,info->sign)))

return(info);
else
info=info->next;
}
return(info);
}
void delete()
{char s[80];
struct student *p1,*p2,*info;
printf("enter name:");
gets(s);
info=find(s);
if(info!=NULL)
{
if(head==info)
{
head=info->next;
printf("delete:%s\n",info->name);
free(info);
}
else
{p2=head;
p1=head->next;
while(info!=p1)
{p2=p1;p1=p1->next;}
p2->next=p1->next;
printf("delete:%s\n",info->name);
free(info);
}
}else
printf("%s not found!\n",info->name);
}
void change()
{char s[30],a[30];
float sum,b;
int i;
struct student *p;
printf("enter name:");
gets(s);
p=find(s);
if(p!=NULL)
{printf("what you want to change:\n name? number? sex? nation? born? family? course?");
gets(a);
printf("please enter %s:",a);
if(strcmp(a,"name")==0)
scanf("%s",p->name);
if(strcmp(a,"number")==0)
scanf("%s",p->number);
if(strcmp(a,"sex")==0)
scanf("%s",p->sex);
if(strcmp(a,"nation")==0)
scanf("%s",p->nation);
if(strcmp(a,"born")==0)
scanf("%s",p->born);
if(strcmp(a,"family")==0)
scanf("%s",p->family);
if(strcmp(a,"course")==0)
scanf("%s",p->course);
circle(p);
}
}
void savefile()
{struct student *p;
FILE *fp;
p=head;
fp=fopen("xue.c","wb");
printf("saving ...");
while(head)
{
fwrite(head,sizeof(record)-2,1,fp);
head=head->next;
}
fclose(fp);
printf("\n the file has been saved\n");
}
void openfile()
{FILE *fp;
struct student *back,*next;
fp=fopen("xue.c","rb");
printf("loading ...");
head=back=next=(struct student *)malloc(sizeof(record));
while(fread(next,sizeof(record)-2,1,fp)==1)
{
back=next;
next=(struct student *)malloc(sizeof(record));
back->next=next;
}
free(next);
back->next=NULL;
printf("\nfile has been opened\n");
}
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
六月天空中的雨
2006-08-26 · TA获得超过181个赞
知道小有建树答主
回答量:429
采纳率:0%
帮助的人:238万
展开全部
呵呵!有趣!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
黑色凉白开
2006-08-26 · TA获得超过497个赞
知道小有建树答主
回答量:599
采纳率:0%
帮助的人:350万
展开全部
你出20分叫人帮你做这个?????搞笑呢?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式