![]() |
#2
aaa999992020-09-17 16:53
|

#include <iostream>
using namespace std;
int main()
{
int a = 0;
int b = 2;
int c = 3;
cout<<"请输入a小猪的体重"<<endl;
cin>>a;
cout<<"请输入b小猪的体重"<<endl;
cin>>b;
cout<<"请输入c小猪的体重"<<endl;
cin>>c;
cout<<"a的体重"<<a<<endl;
cout<<"b的体重"<<b<<endl;
cout<<"c的体重"<<c<<endl;
if (a>b)
{
if (a>c)
{
cout<<"小猪a体重最重"<<endl;
}
else if(a=c)
{
cout<<"小猪a c体重最重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
else if(a=b)
{
if(a>c)
{
cout<<"小猪a b体重最重"<<endl;
}
else if (a=c)
{
cout<<"小猪a b c一样重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
else if (a<b)
{
if(b>c)
{
cout<<"小猪b体重最重"<<endl;
}
else if (b=c)
{
cout<<"小猪b c体重最重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
system("pause");
return 0;
}
using namespace std;
int main()
{
int a = 0;
int b = 2;
int c = 3;
cout<<"请输入a小猪的体重"<<endl;
cin>>a;
cout<<"请输入b小猪的体重"<<endl;
cin>>b;
cout<<"请输入c小猪的体重"<<endl;
cin>>c;
cout<<"a的体重"<<a<<endl;
cout<<"b的体重"<<b<<endl;
cout<<"c的体重"<<c<<endl;
if (a>b)
{
if (a>c)
{
cout<<"小猪a体重最重"<<endl;
}
else if(a=c)
{
cout<<"小猪a c体重最重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
else if(a=b)
{
if(a>c)
{
cout<<"小猪a b体重最重"<<endl;
}
else if (a=c)
{
cout<<"小猪a b c一样重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
else if (a<b)
{
if(b>c)
{
cout<<"小猪b体重最重"<<endl;
}
else if (b=c)
{
cout<<"小猪b c体重最重"<<endl;
}
else
{
cout<<"小猪c体重最重"<<endl;
}
}
system("pause");
return 0;
}
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录