简单题,建个结构体

/*ID:nealgav1
PROG:gift1
LANG:C++
*/
#include<cstdio>
#include<cstring>
#define N 2004
class people
{
public:
char name[20];
int money;
};
int m;
people name[N];
int getid(char name_[])
{
for(int i=0;i<m;i++)
{
if(strcmp(name[i].name,name_)==0)
return i;
}
}
int main()
{
freopen("gift1.in","r",stdin);
freopen("gift1.out","w",stdout);
int money_,num,i,j;
char name_[20];
while(scanf("%d",&m)!=EOF)
{
for(i=0;i<m;++i)
{
scanf("%s",name[i].name);
name[i].money=0;
}
for(i=0;i<m;++i)
{
scanf("%s",name_);
scanf("%d %d",&money_,&num);
if(num)
{ name[getid(name_)].money+=money_%num-money_;
money_/=num;
}
if(money_&&!num)
{
name[getid(name_)].money+=money_;
}
for(j=0;j<num;j++)
{
scanf("%s",name_);
name[getid(name_)].money+=money_;
}
}
for(i=0;i<m;++i)
{
printf("%s %d\n",name[i].name,name[i].money);
}
}
return 0;
}