标题:选择性结构
取消只看楼主
编程吗
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2018-3-13
结帖率:33.33%
已结贴  问题点数:5 回复次数:0 
选择性结构
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    int score;
    scanf("%d",&score);
    printf("your score is ");   
    switch(score){
        case'90':printf("优秀");break;
        case'80':printf("良好");break;
        case'70':printf("一般");break;
        case'60':printf("加油");break;
        default:printf("你的输入有错");
    }
     return 0;
}
这个代码为什么定义为char就行,定义为int就不行
搜索更多相关主题的帖子: int score printf case break 
2018-04-06 14:54



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




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

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