switch问题:哪里错了啊,抓狂!~

[复制链接]
查看11 | 回复5 | 2012-7-2 17:53:13 | 显示全部楼层 |阅读模式
case后面不能接条件。建议修改为:switch(a/10) {case 10:case 9:
printf("A\n");
break;case 8:
printf("B\n");
break;case 7:
printf("C\n");
break;case 6:
printf("D\n");
break;case 5:case 4:case 3:case 2:case 1:case 0:
printf("E\n");...
回复

使用道具 举报

千问 | 2012-7-2 17:53:13 | 显示全部楼层
switch是不能用表达式的case后面不能跟表达式可以跟 intlongcharenum...
回复

使用道具 举报

千问 | 2012-7-2 17:53:13 | 显示全部楼层
case 后面只能跟字母和数字#include "stdafx.h"#include "stdio.h"int main(int argc, char* argv[]){ int a; a=88; printf("88分的成绩等级为:"); int n = a / 10; switch(n) { case 10:...
回复

使用道具 举报

千问 | 2012-7-2 17:53:13 | 显示全部楼层
switch(a/10){case 9:case 8:...case 6:default:}...
回复

使用道具 举报

千问 | 2012-7-2 17:53:13 | 显示全部楼层
case(常量表达式)...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行