|
|
back to boardWA7 Access Violation Posted by dastan 2 Dec 2011 12:48 I have access violation on the test 7! Help me, please! This is my code, sorry for my bad English! #include <iostream> using namespace std; int main() { int n; cin>>n; int a=0; int c=0; char nMatrix[100][31]; char str[10]; bool nArray[100]; cin.getline(str,10); for(int i=0;i<n;i++) { cin.getline(nMatrix[i],31); } for(int i=0;i<n;i++) { nArray[i] = false; } for(int i=0;i<n;i++) { if(!nArray[i]) { for(int j=i;j<n;j++) { if(strcmp(nMatrix[i],nMatrix[j])==0) { nArray[j] = true; a++; } } } if(a!=0) a--; c+=a; a=0; } cout<<c<<endl; return 0; } Re: WA7 Access Violation Posted by qvert 11 Dec 2011 15:22 char nMatrix[1000][31]; bool nArray[1000]; Re: WA7 Access Violation Posted by dastan 16 Dec 2011 04:06 Thank you!!! I'm real lol)))) |
|
|