C++程序 给出一百分制成绩,要求输出成绩等级‘A’,‘B’,‘C’,‘D’,‘E’.90分以上为‘A’
问题描述:
C++程序 给出一百分制成绩,要求输出成绩等级‘A’,‘B’,‘C’,‘D’,‘E’.90分以上为‘A’
给出一百分制成绩,要求输出成绩等级‘A’,‘B’,‘C’,‘D’,‘E’.90分以上为‘A’,80~89分为‘B’,70~79分为‘C’,60~69分为‘D’,60分以下为‘E’.
求速回
#include
using namespace std;
void main()
{
\x05coutx;
if (x100)
\x05\x05cout
答
using namespace std;
void main()
{
cout<<"write your mark here fool";
int x;
cin>>x;
if (x<0||x>100)
cout<<"your number is wrong";
else if (x>=90)
cout<<"A";
else if (x>=80)
cout<<"your score belong to B";
else if (x>=70)
cout<<"C";
else if (x>=60)
cout<<"D";
else cout<<"shit you got a E";
//return 0;
}
有几个问题,
x后边的分号是中文字符
main函数是void,不用return 0;
另外,根据题意,应该在90,80等判定时有等号
#include<iostream>using namespace std;
void main()
{
cout<<"write your mark here fool";
int x;
cin>>x;
if (x<0||x>100)
cout<<"your number is wrong";
else if (x>=90)
cout<<"A";
else if (x>=80)
cout<<"your score belong to B";
else if (x>=70)
cout<<"C";
else if (x>=60)
cout<<"D";
else cout<<"shit you got a E";
//return 0;
}