|
|
back to boardWA test 1. what's wrong? #include <cstdlib> #include <iostream> using namespace std; struct xxx{ char x[30]; }A[100]; int main() {int n,i,j,k=0; cin>>n; fflush(stdin); for (i=0;i<n;i++) cin.getline(A[i].x,30); for(i=0;i<(n-1);i++) if (strcmp(A[i].x,"")){ for(j=i+1;j<n;j++) if (!strcmp(A[i].x,A[j].x)) {if(k==0){cout<<A[i].x;k++;} else cout<<endl<<A[i].x; for(j;j<n;j++) if(!strcmp(A[i].x,A[j].x)) strcpy(A[j].x,""); } } return 0;
} |
|
|