最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
简易的学生管理系统
时间:2022-07-02 10:57:10 编辑:袖梨 来源:一聚教程网
#include"stdio.h"
#include"string.h"
#include"stdlib.h"
#define N 3
#define increase 4
#define NULL 0
typedef struct stud
{
char name[15];
int age;
float score;
struct stud *next;
}L;/*定义表的类型*/
L*p,*that,*othernew,*x,*you,*head;
L * enter_record ()/*加入记录*/
{
int n,i=0;
float m;
L *new;
head=new=(L*)malloc(N*sizeof(L));
if(!new)
{
printf("failure for applying room!n");
exit(0);
}
else
{
p=new;
while(i
i++;
printf("please enter name:");
fflush(stdin);
gets(p->name);
printf("n");
printf("enter age:");
fflush(stdin);
scanf("%d",&n);
printf("n");
p->age=n;
printf("enter the score:");
fflush(stdin);
scanf("%f",&m);
p->score=m;
p=p->next;
}
}
return head;
}
L *show_record()/*显示记录*/
{
int c=1;
L *this;
printf("the records are:n");
this=head;
while(this->next!=NULL)
{
printf("the %d th is:n");
printf("the name is:%sn",this->name);
printf("the age is:%dn",this->age);
printf("the score is:%fn");
this=this->next;
c++;
}
printf("the number of records is:%d",c);
return head;
}
L *delete_record()/*删除记录*/
{
int d;
printf("which one record do you want to delete?number:");
fflush(stdin);
scanf("%d",&d);
printf("n");
if(d>N-1||d<0)
{
printf("error due to the wrong input!n");
exit(0);
}
else
{
int e=1;
that=head;
while(that->next!=NULL&&e
that=that->next;
e++;
}
that->next=that->next->next;
free(that->next);
printf("the record has been deleted!n");
}
return head;
}
L * insert_record()/*加入新的记录*/
{
int y;
printf("where will you insert the new record?number:");
fflush(stdin);
scanf("%d",&y);
printf("n");
if(y>=1&&y<=N)
{
int z=1,g,h;
x=head;
while(x->next!=NULL&&z<=N)
{
z++;
x=x->next;
}
othernew=(L*)malloc(sizeof(L));
x->next=othernew;
othernew=x->next->next;
printf("please input the name new record:%sn",othernew->name);
scanf("%d",&g);
printf("enter the age:%dn",g);
scanf("%d",
相关文章
- 时空中的绘旅人天宇之间怎么玩 绘旅人天宇之间活动玩法介绍 12-25
- QQ2024年度报告怎么看 2024qq年度报告玩法介绍 12-25
- 归龙潮珠砂什么时候up 归龙潮红缘绮梦卡池介绍 12-25
- 王者荣耀S38赛季有什么更新 12-25
- 王者荣耀S38赛季有什么更新 王者荣耀S38赛季更新内容介绍 12-25
- 世界之外12.25有什么更新 世界之外12月25日更新内容介绍 12-25