#include<stdio.h>
#include<string.h>
struct stu
{
char name[20];
int count;
}
candidate[5]={{"chen",0},{"li",0},{"zhang",0},{"luo",0},{"den",0}};
void main()
{int i,j;
char candidate_name[20];
for(i=1;i<=20;i++)
{
scanf("%s",candidate_name);
for(j=0;j<=5;j++)
if(strcmp(candidate_name,candidate[i].name)==0)
candidate[i].count++;
}
printf("\n");
for(i=0;i<=5;i++)
printf("%5s 的票数:%d\n",candidate[i].name,candidate[i].count);
}
#include<string.h>
struct stu
{
}
candidate[5]={{"chen",0},{"li",0},{"zhang",0},{"luo",0},{"den",0}};
void main()
{int i,j;
char candidate_name[20];
for(i=1;i<=20;i++)
{
}
printf("\n");
for(i=0;i<=5;i++)
printf("%5s 的票数:%d\n",candidate[i].name,candidate[i].count);
}