帮忙看看!投票系统代码!自己撸的!能运行!会提示错误!有心人帮忙瞧瞧
# include <stdio.h># include <string.h>
struct stduet
{
int a;
char b;
} stduet1;
int main()
{
charstduet2;
int i,j;
struct stduet stduet1={{0,"强哥"},{0,"包子"},{0,"标子"}};
printf("谁是帅哥");
printf("候选人名单:强哥,标子,包子\n");
for (j=1;j<5;j++)
{
printf ("请输入第%d个候选人:",j);
scanf ("%s\n",&stduet2);
for (i=0;i<3;i++)
{
if (strcmp(stduet1.b,&stduet2)==0)
{
stduet1.a++;
}
}
}
for (i=0;i<3;i++)
{
printf ("投票结果:姓名%s 得票%d\n",stduet1.b,stduet1.a);
}
}
# include <stdio.h>
# include <string.h>
struct student
{
int a;
char b;
};
//
int main()
{
charstudent2;
int i,j;
struct student student1={{0,"强哥"},{0,"包子"},{0,"标子"}};
printf("谁是帅哥:");
printf("候选人名单:强哥,标子,包子\n");
for (j=1;j<5;j++)
{
printf ("请输入第%d个候选人:",j);
scanf ("%s",student2);
for (i=0;i<3;i++)
{
if (strcmp(student1.b,student2)==0)
{
student1.a++;
}
}
}
for (i=0;i<3;i++)
{
printf ("投票结果:姓名%s 得票%d\n",student1.b,student1.a);
}
return 0;
}
谢谢了!对我很有用! 围观中哈 帮忙定下 也不加点注释←_← 围观 看看 看看
页:
[1]