输入百分制的成绩score转换成相应的五分制成绩grade并输出
用C语言程序设计解决。#include<iostream>usingnamespacestd;intmain(){intscore;chargrade;cin>>scor...
用C语言程序设计解决。#include<iostream>
using namespace std;
int main()
{
int score;
char grade;
cin>>score;
{
switch(score/10);
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:grade='E';break;
case 6:grade='D';break;
case 7:grade='C';break;
case 8:grade='B';break;
case 9:
case 10:grade='A';break;
}
cout<<grade<<endl;
}
default:cout<<"score error\n";
system("pause");
return 0;
}
请问我哪里错了? 展开
using namespace std;
int main()
{
int score;
char grade;
cin>>score;
{
switch(score/10);
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:grade='E';break;
case 6:grade='D';break;
case 7:grade='C';break;
case 8:grade='B';break;
case 9:
case 10:grade='A';break;
}
cout<<grade<<endl;
}
default:cout<<"score error\n";
system("pause");
return 0;
}
请问我哪里错了? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询