You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.2 KiB
70 lines
1.2 KiB
1 year ago
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
struct stu
|
||
|
{
|
||
|
char num[20];
|
||
|
int c,x;
|
||
|
char name[20];
|
||
|
float m,p,e,s;
|
||
|
};
|
||
|
|
||
|
struct stu stu[3]={{"10001",11,1,"Zhang",99.5,88.5,89.5},
|
||
|
{"10002",12,1,"Yang",77.9,56.5,87.5},
|
||
|
{"10003",11,1,"Liang",92.5,99.0,60.5}};
|
||
|
|
||
|
|
||
|
void ee(struct stu* stu,char* a[20])
|
||
|
{
|
||
|
int i,exist=0;
|
||
|
for (i=0;i<3;i++)
|
||
|
{
|
||
|
if(strcmp((stu+i)->num,a)==0||strcmp((stu+i)->name,a)==0)
|
||
|
{
|
||
|
(stu+i)->x=0;
|
||
|
exist=1;
|
||
|
}
|
||
|
}
|
||
|
if(exist)
|
||
|
{
|
||
|
|
||
|
char w;scanf(" %c",&w);
|
||
|
if(w=='y')
|
||
|
{
|
||
|
int st=0;
|
||
|
for(i=0;i<2;i++)
|
||
|
{
|
||
|
if(!(stu+i)->x||st==1)
|
||
|
{
|
||
|
st=1;
|
||
|
*(stu+i)=*(stu+i+1);
|
||
|
}
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
else if(w=='n')
|
||
|
{
|
||
|
for(i=0;i<3;i++)
|
||
|
{
|
||
|
stu[i].x=1;
|
||
|
printf("%s %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].c,stu[i].name,stu[i].m,stu[i].p,stu[i].e);
|
||
|
}return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{int i;
|
||
|
char a[20];
|
||
|
scanf("%s",a);
|
||
|
for (i=0;i<3;i++)
|
||
|
{
|
||
|
if(strcmp((stu+i)->num,a)==0||strcmp((stu+i)->name,a)==0)
|
||
|
{
|
||
|
(stu+i)->x=0;printf("Are you sure(yes/no)?\n");
|
||
|
}
|
||
|
}
|
||
|
for(i=0;i<3;i++) if((stu+i)->x) printf("%s %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].c,stu[i].name,stu[i].m,stu[i].p,stu[i].e);
|
||
|
ee(stu,a);
|
||
|
return 0;
|
||
|
}
|