发布网友 发布时间:2022-07-01 10:49
共2个回答
热心网友 时间:2023-10-20 11:06
按照你的要求编写的C++程序如下
#include<iostream>
using namespace std;
int main(){
int age;
cout<<"你几岁了?";
cin>>age;
if(age<=15){
cout<<"you are a child"<<endl;
}else if(15<age && age<40){
cout<<"you are a young"<<endl;
}else{
cout<<"you are old"<<endl;
}
return 0;
}
热心网友 时间:2023-10-20 11:07
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "你几岁了?";
cin >>a;
if(a<=15)
cout << "you are a child";
else if(a<40)
cout << "you are a young";
else
cout << "you are old";
return 0;
}