一道C++编程题,请高手帮我看看我的答案对吗?
发布网友
发布时间:2024-02-23 19:44
我来回答
共5个回答
热心网友
时间:2024-03-24 03:13
思想是对的 不过强烈建议入门一定要养成良好的编程习惯和风格!!!
#include<iostream>
using namespace std;
int main(){
int a=0;
cout<<"Enter a number:";
cin>>a;
cout<<endl;
cout<<(a>100?
"a is greater than 100."
:(a>30?
"a is greater than 30 and is less than 100."
:(a>20?
"a is greater than 20 and is less than 30."
:(a<20?
"a is less than 20."
:"a is 20."
)
)
)
);
return 0;
}
热心网友
时间:2024-03-24 03:07
搞不懂
热心网友
时间:2024-03-24 03:08
对的
热心网友
时间:2024-03-24 03:07
是对的,但是编的可读性极差,貌似有显摆的嫌疑,这样对以后的提高不好,编C++一定要注重可读性,可操作性。
热心网友
时间:2024-03-24 03:14
对的,要把“和”换成",#include<iostream> 的‘#’换成#