杭电1004结果一直是Runtime Error(ACCESS_VIOLATION)

2024-11-30 15:24:01
推荐回答(1个)
回答1:

#include
using namespace std;

struct Balloon{
int cnt;
char name[20];
}Ball[1010];

int main()
{
int n;
int i,j,t;
int max=0,count=0;

char ch[20];
while(cin>>n&&n)
{
for(i=0;i {
cin>>ch;
if(i==0)
{
Ball[count].cnt=1;
strcpy(Ball[count++].name,ch);
}
max = 1;
for(j=0;j if(strcmp(ch,Ball[j].name)==0)
{
Ball[j].cnt++;
max = 0;
}
if(max)
{
Ball[count].cnt=1;
strcpy(Ball[count++].name,ch);
}
}
max = 0;
for(i=0;i if(max {
max=Ball[i].cnt;
t=i;
}
cout< count=0;
max=0;
}
return 0;
}