|
|
back to boardcan you tell me why it is wrong? Posted by xinxin 20 Sep 2016 19:28 #include<stdio.h.> #include<string.h> int main() { int i,j,temp,re,q; int a[6]={0,0,0,0,0,0}; int b[6]; char c[6][20]; for(i=0;i<6;i++) { char d[20]; scanf("%s",d); scanf("%s",c[i]); scanf("%d",&b[i]); } for(i=0;i<6;i++) { for(j=0;j<6;j++) { if(strcmp(c[j],c[i])==0) a[i]++; } }
temp=a[0]; re=b[0]; for(i=0;i<6;i++) { if((a[i]>temp)||((a[i]==temp)&&b[i]<=re)) { temp=a[i]; re=b[i]; q=i; } }
printf("%s",c[q]); fflush(stdin); getchar(); return 0; }
|
|
|