printf("\t\t*****************************************\n");
printf("\t\t*\t1:the char i is input \t*\n");
printf("\t\t*\t2:the char o is output\t*\n");
printf("\t\t*\t3:the char g is xiugai\t*\n");
printf("\t\t*\t4:the char q is tui chu\t*\n");
printf("\t\t*\t5:the char s is savelis\t*\n");
printf("\t\t*\t6:the char d is dellist\t*\n");
printf("\t\t*****************************************\n");
while(1)
{
printf("\nput your donzhu:");
//flag=getch();
scanf("%c",&flag);
switch(flag)
{
case 'i' : {int i;
printf("put number student :\t");
scanf("%d",&i);
putin(i);
} break;
case 'o' : {int i;
printf("put number student :\t");
scanf("%d",&i);
putout(i);
}break;
case 'd' : dellist(); break;
case 'g' : xiugai(); break;
// case 's' : data_save(); break;
case 'q' : goto tuichu; break;
}
}//end while
tuichu: // goto结束语
return 0;
}
//输入数据
void putin(int i)
{
b=b+1;
x++;
if(sut[i].flag==1) {printf("\t\there is a people!\n");return;}
printf("put the number:\t");
scanf("%s",sut[i].number);
printf("\nput the name:\t");
scanf("%s",sut[i].name);
printf("\nput the sex:\t");
scanf("%s",sut[i].sex);
printf("\n");
printf("\nput the score:\n");
printf("put the shu:\t");
scanf("%f",&sut[i].sco.shu);
printf("\nput the li:\t");
scanf("%f",&sut[i].sco.li);
printf("\nput the hua:\t");
scanf("%f",&sut[i].sco.hua);
sut[i].sco.vi();
sut[i].flag=1;
if(b>1)
paixu();//输入完后自动排序
}
printf("\n");
printf("\n\t\tput the score:\n");
printf("\t\tthe shu:\t%f",sut[i].sco.shu);
printf("\n\t\tthe li: \t%f",sut[i].sco.li);
printf("\n\t\tthe hua:\t%f\n",sut[i].sco.hua);
printf("\n\t\the average is:\t%f\n",sut[i].sco.average);
}
//修改数据
void xiugai(void)
{
int i;
printf("put number student :\t");
scanf("%d",&i);
if(sut[i].flag!=1) {putin(i);return;}
printf("put the number:\t%s",sut[i].number);
printf("\nput the xiugai:\t");
scanf("%s",sut[i].number);
printf("\nput the name:\t%s",sut[i].name);
printf("\nput the name:\t");
scanf("%s",sut[i].name);
printf("\nput the sex:\t%s",sut[i].sex);
printf("\nput the sex:\t");
scanf("%s",sut[i].sex);
printf("put the shu:\t%d",sut[i].sco.shu);
printf("\nput the shu:\t");
scanf("%f",&sut[i].sco.shu);
printf("\nput the li:\t%d",sut[i].sco.li);
printf("\nput the li:\t");
scanf("%f",&sut[i].sco.li);
printf("\nput the hua:\t%d\n",sut[i].sco.hua);
printf("\nput the hua:\t");
scanf("%f",&sut[i].sco.hua);
}
void dellist(void)
{
char fla=0;
printf("\t\tpress n use name");
printf("\n\t\tpress l use number");
printf("\nyou char is :\t");
getchar();
while(1)
{
int main(void)
{
struct student *head;
head=NULL;
struct student *p1;
char name[8];
char flag;
char flagc=0;
unsigned char stu=0;
printf("\n*****************************************\n");
printf("*\t the action:\t\t\t*\n");
printf("*\t 1:char i is a input!\t\t*");
printf("\n*\t 2:char o is a output!\t\t*");
printf("\n*\t 3:char d is a delname!\t\t*");
printf("\n*\t 4:char a is a insert!\t\t*");
printf("\n*\t 6:char m is amend!\t\t*");
printf("\n*\t 7:char n is count student!\t*");
printf("\n*\t 5:char q is quit!\t\t*");
printf("\n*****************************************\n");
while(1)
{
fflush(stdin);
printf("\nput your action:\t");
scanf("%c",&flag);
fflush(stdin);
switch(flag)
{
case 'i' : {if(flagc==0)
{flagc=1;head=creat();}
else
{flagc=0;frees(head);head=creat();}
}break;
case 'o' : prin(head);break;
case 'd' :
{
printf("the name:\t");
scanf("%s",name);
head=del(head,name);
} break;
case 'a' :
{
p1=(struct student *)malloc(sizeof(struct student));
printf("put the number:\t");
scanf("%s",p1->number);
printf("\nput the name:\t");
scanf("%s",p1->name);
printf("\nput the sex:\t");
scanf("%s",p1->sex);
printf("\n");
printf("\nput the score:\n");
printf("put the shu:\t");
scanf("%f",&p1->sco.shu);
printf("\nput the li:\t");
scanf("%f",&p1->sco.li);
printf("\nput the hua:\t");
scanf("%f",&p1->sco.hua);