Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎麽只输入"END"啊?#include<stdio.h> #include<string.h> struct student { char name[10]; int date; int Sweight; int num[100]; }stu[100]; int main() { int i=0,l,max,p,k=0; char c[10]; char a[10]="END"; scanf("%s",c); scanf("%s %d %d",stu[i].name,&stu[i].date,&stu[i].Sweight); while(strcmp(stu[i].name,a)!=0) { stu[i].num[i]=stu[i].Sweight-stu[i].date; i++; scanf("%s%d%d",stu[i].name,&stu[i].date,&stu[i].Sweight); } while(k<i) { p=0; max=stu[0].num[0]; for(l=0;l<i;l++) { if(stu[l].num[l]>max) {max=stu[l].num[l]; p=l;} } printf("%s\n",stu[p].name); stu[p].num[p]=-999; k++; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator