标题:帮忙看一下程序哪里出问题了
只看楼主
csy294745333
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2012-3-27
结帖率:9.09%
 问题点数:0 回复次数:3 
帮忙看一下程序哪里出问题了
程序代码:
main()
{
      float score;
      int num,a,b,c,d,e,i;
      a=b=c=d=e=0;
      i=0;
      printf("please input the total students.\n");
      scanf("%d",&num);
      printf("please input each student's score.\n");
      while(i<num)
      {
        scanf("%f",&score);
        if(score>100||score<0)
        (
        printf("error!repeat input\n");
        continue;
      }
      switch((int)(score/10))
      {
      case 10:
      case 9:a=a+1;break;
      case 8;b=b+1;break;
      case 7:c=c+1;break:
      case 6:d=d+1;break;
      case 5:
      case 4:
      case 3:
      case 2:
      case 1:
      case 0:e=e+1;break;
      }
      i=i+1;
      }
printf("over 90:%d\n",a);
printf("80~89:%d\n",b);
printf("70~79:%d\n",c);
printf("60~69:%d\n",d);
printf("below60:%d\n",e);
system("pause");
}
        printf("error!repeat input\n");
这一行报错
错误信息
39 D:\计算机\编程活动\3.4编程活动二 成绩管理.c [Warning] data definition has no type or storage class
找不到错误
搜索更多相关主题的帖子: please color 
2012-04-08 09:09
csy294745333
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2012-3-27
得分:0 
39 D:\计算机\编程活动\3.4编程活动二 成绩管理.c syntax error before string constant
好像还有这个
2012-04-08 09:10
苦寒
Rank: 2
等 级:论坛游民
帖 子:18
专家分:55
注 册:2012-3-22
得分:0 
#include "stdio.h"
#include "stdlib.h"
main()
{
    float score;
    int num,a,b,c,d,e,i;
    a=b=c=d=e=0;
    i=0;
    printf("please input the total students.\n");
    scanf("%d",&num);
    printf("please input each student's score.\n");
    while(i<num)
    {
        scanf("%f",&score);
        if(score>100||score<0)
        {
            printf("error!repeat input\n");
            continue;
        }
        switch((int)(score/10))
        {
           case 10:
           case 9:a=a+1;break;
           case 8:b=b+1;break;
           case 7:c=c+1;break;
           case 6:d=d+1;break;
           default:e=e+1;break;
        }
        i=i+1;
    }
    printf("over 90:%d\n",a);
    printf("80~89:%d\n",b);
    printf("70~79:%d\n",c);
    printf("60~69:%d\n",d);
    printf("below 60:%d\n",e);
    system("pause");
}
2012-04-08 09:32
阴阳
Rank: 4
等 级:业余侠客
帖 子:102
专家分:297
注 册:2012-4-7
得分:0 
程序代码:
#include <stdio.h>
void main()

 {
       float score;
       int num,a,b,c,d,e,i;
       a=b=c=d=e=0;
       i=0;
       printf("please input the total students.\n");
       scanf("%d",&num);
       printf("please input each student's score.\n");
       while(i<num)
       {
         scanf("%f",&score);
         if(score>100||score<0)
         {
         printf("error!repeat input\n");
         continue;
       }
       switch((int)(score/10))
       {
       case 10:
       case 9: a=a+1;break;
       case 8: b=b+1;break;//8后边是“:”
       case 7: c=c+1;break;//break后边是“;”
       case 6: d=d+1;break;
       case 5:
       case 4:
       case 3:
       case 2:
       case 1:
       case 0: e=e+1;break;
       }
       i=i+1;
       }

 printf("over 90:%d\n",a);

 printf("80~89:%d\n",b);

 printf("70~79:%d\n",c);

 printf("60~69:%d\n",d);

 printf("below60:%d\n",e);

 system("pause");

 }

没有错!

一阴一阳之谓道!
2012-04-08 09:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-365353-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056396 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved