复习c++ day01 关于if语句复习
#include<iostream>
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
int num3 = 0;
cout<<"输入小猪a的体重"<<endl;
cin>>num1;
cout<<"输入小猪b的体重"<<endl;
cin>>num2;
cout<<"输入小猪c的体重"<<endl;
cin>>num3;
if(num1<num2){
if(num3>num2){
cout<<"小猪c体重最重"<<endl;
}else{
cout<<"小猪b体重最重"<<endl;
}
}else{
if(num1>num3){
cout<<"小猪a体重最重"<<endl;
}else{
cout<<"小猪c体重最重"<<endl;
}
}
}
运行结果