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.
36 lines
909 B
36 lines
909 B
1 year ago
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
#define N 3
|
||
|
struct Student
|
||
|
{char xuehao[10];
|
||
|
int banji;
|
||
|
char name[20];
|
||
|
float grade1;
|
||
|
float grade2;
|
||
|
float grade3;
|
||
|
};
|
||
|
int main()
|
||
|
{struct Student st[N]={{"10001",11,"Zhang",99.5,88.5,89.5},
|
||
|
{"10002",12,"Yang",77.9,56.5,87.5},
|
||
|
{"10003",11,"Liang",92.5,99.0,60.5}};
|
||
|
int i,j=-1,k,l;
|
||
|
char c='a';
|
||
|
char s[20];
|
||
|
scanf("%s",s);
|
||
|
for(i=0;i<N;i++)
|
||
|
if(strcmp(s,st[i].xuehao)==0||strcmp(s,st[i].name)==0)
|
||
|
{j=i;break;}
|
||
|
for(k=0;k<N;k++)
|
||
|
{if(k==j)continue;
|
||
|
else printf("%s %d %s %.1f %.1f %.1f\n",st[k].xuehao,st[k].banji,st[k].name,st[k].grade1,st[k].grade2,st[k].grade3);
|
||
|
|
||
|
}
|
||
|
printf("Are you sure?(yes/no)\n");
|
||
|
while(c){ scanf("%c",&c);
|
||
|
if(c=='n') {for(l=0;l<N;l++)
|
||
|
printf("%s %d %s %.1f %.1f %.1f\n",st[l].xuehao,st[l].banji,st[l].name,st[l].grade1,st[l].grade2,st[l].grade3); }
|
||
|
if(c=='y'||c=='n')break;}
|
||
|
return 0;
|
||
|
}
|
||
|
|