China Naming Network - Ziwei Dou Shu - Csharp name drawing process
Csharp name drawing process
# include & ltstdio.h & gttypedef structural personnel
{
Int count; //votes
Character name [10];
} people;
int main()
{
int i,flag
Person per[5]={{0, "Zhang"}, {0, "Wang"}, {0, "Li"}, {0, "Zhao"}, {0, "Liu"};
Printf ("Enter the number of votes (0- Zhang, 1- Wang, 2- Li, 3- Zhao, 4- Liu, 5- End voting:");
flag = 0; And (me! =5)
{
scanf("%d ",& ampI);
Switch (1)
{
Case 0:
According to [0]. count++;
Break;
Case 1:
According to [1]. count++;
Break;
Case 2:
According to [2]. count++;
Break;
Case 3:
According to [3]. count++;
Break;
Case 4:
According to [5]. count++;
Break;
Case 5:
flag = 1;
Break;
}
if(flag == 1)
{
Break;
}
}
Printf(" Name \ t votes \ n ");
for(I = 0; I<5; i++)
{
printf("%s\t%d\n ",per[i]。 Name, press [i]. Count);
}
Returns 0;
}