鱼C论坛

 找回密码
 立即注册
查看: 2281|回复: 8

帮忙看看!投票系统代码!自己撸的!能运行!会提示错误!有心人帮忙瞧瞧

[复制链接]
发表于 2014-8-6 08:26:39 | 显示全部楼层 |阅读模式
1鱼币
# include <stdio.h>
# include <string.h>
struct stduet
    {
    int a;
    char b[20];
} stduet1[3];
     int main()
     {
     char  stduet2[30];
     int i,j;
struct stduet stduet1[3]={{0,"强哥"},{0,"包子"},{0,"标子"}};
printf("谁是帅哥");
printf("候选人名单:强哥,标子,包子\n");
    for (j=1;j<5;j++)
{
        printf ("请输入第%d个候选人:",j);
         scanf ("%s\n",&stduet2[30]);
for (i=0;i<3;i++)
{
if (strcmp(stduet1[i].b,&stduet2[30])==0)
{
stduet1[i].a++;
}
}
}
for (i=0;i<3;i++)
{
  printf ("投票结果:姓名%s   得票%d\n",stduet1[i].b,stduet1[i].a);
}
  }

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-6 08:38:47 | 显示全部楼层
  1. # include <stdio.h>
  2. # include <string.h>

  3. struct student
  4.     {
  5.     int a;
  6.     char b[20];
  7. };

  8. //
  9. int main()
  10. {
  11.      char  student2[30];
  12.      int i,j;
  13.         struct student student1[3]={{0,"强哥"},{0,"包子"},{0,"标子"}};
  14.         printf("谁是帅哥:");
  15.         printf("候选人名单:强哥,标子,包子\n");
  16.     for (j=1;j<5;j++)
  17.         {
  18.         printf ("请输入第%d个候选人:",j);
  19.         scanf ("%s",student2);
  20.                 for (i=0;i<3;i++)
  21.                 {
  22.                         if (strcmp(student1[i].b,student2)==0)
  23.                         {
  24.                                 student1[i].a++;
  25.                         }
  26.                 }
  27.         }
  28.         for (i=0;i<3;i++)
  29.         {
  30.                   printf ("投票结果:姓名%s   得票%d\n",student1[i].b,student1[i].a);
  31.         }
  32.        
  33.         return 0;
  34. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2014-8-6 14:19:01 | 显示全部楼层
谢谢了!对我很有用!
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-9 13:18:44 | 显示全部楼层
围观中哈
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-9 13:27:35 | 显示全部楼层
帮忙定下
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-9 17:07:32 | 显示全部楼层
也不加点注释←_←
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-11 21:35:23 | 显示全部楼层
围观
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-13 12:09:26 | 显示全部楼层
看看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2015-8-6 10:22:43 | 显示全部楼层
看看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-20 15:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表