当前位置: 代码迷 >> C语言 >> 有点技术含量的代码!来看看那里有错.嘿嘿.
  详细解决方案

有点技术含量的代码!来看看那里有错.嘿嘿.

热度:140   发布时间:2008-01-22 23:22:30.0
有点技术含量的代码!来看看那里有错.嘿嘿.
#include "stdio.h"



int main()
{
    int grade;
    int acount =0;
    int bcount =0;
    int ccount =0;
    int dcount =0;
    int fcount =0;

    printf ("enter the letter grades.\n");
    printf ("enter the EOF character to end input.\n" );

    while ( (grade=getchar() ) !=EOF){

    switch (grade){
    case 'A' :
    case 'a' :
    ++acount ;
    break ;

    case 'B' :
    case 'b' :
    ++bcount ;
    break ;

    case 'C' :
    case 'c' :
    ++ccount ;
    break ;

    case 'D' :
    case 'd' :
    ++ccount ;
    break ;

    case 'F' :
    case 'f' :
    ++ccount ;
    break ;

    case  '\n':
    case  '\t':
    case  ' ':
    break ;

    default :
    printf ("incorrect letter grade entered.");
    printf  ("enter a new grade.\n");
    break ;

    }

    }
    printf ("\n totals for each letter grade are:\n");
    printf ("A: &d\n",acount);
    printf ("B: &d\n",bcount);
    printf ("C: &d\n",ccount);
    printf ("D: &d\n",dcount);
    printf ("F: &d\n",fcount);

    getch();
}
测试的时候要不要自己的要求.whitch case default 语句
搜索更多相关的解决方案: 含量  技术  代码  

----------------解决方案--------------------------------------------------------
晕一下。。。。。你想干什么?
----------------解决方案--------------------------------------------------------
想看到输出的结果!但是他一输出结果就关闭了!指点
----------------解决方案--------------------------------------------------------

#include <stdlib.h>
system("pause");
----------------解决方案--------------------------------------------------------
LZ想统计ABCDF字母的个数``但是```
我运行的时候没问题啊````

按完后``是停了下啊``然后我随便按``就退出了``
我在DEV-CPP里运的``GETCH()在CONIO。H里面``
----------------解决方案--------------------------------------------------------
技术含量
----------------解决方案--------------------------------------------------------
加上
#include<conio.h>
----------------解决方案--------------------------------------------------------
楼主比较不厚道,我也鞭一下尸,罪过
----------------解决方案--------------------------------------------------------

----------------解决方案--------------------------------------------------------
呵呵,我运行的时候没法退出啊,
----------------解决方案--------------------------------------------------------
  相关解决方案