帮忙看一个最简单的C++的一个错误和3个警告!!

来源:百度知道 编辑:UC知道 时间:2024/06/20 10:58:37
#include"iostream.h"
int program()
{
int a,b,c,temp;
cout<<"请输入3个数"<<endl;
cin>>a,b,c;
if (b<c);
{
b=temp;
temp=c;
c=b;
}
if (a<c);
{
temp=a;
a=c;
c=temp;
}
if (a<b);
{
temp=b;
b=a;
a=temp;
}
cout<<"从大到小排列的顺序为:"<<a,b,c<<endl;
return 0;
}
就这个,提示倒数第3行,就是看不出来哪儿错了

修改好了:

#include"iostream.h"
int main()
{
int a,b,c,temp;
cout<<"请输入3个数"<<endl;
cin>>a>>b>>c;
if (b<c);
{
temp=c;
c=b;
b=temp;
}
if (a<c);
{
temp=a;
a=c;
c=temp;
}
if (a<b);
{
temp=b;
b=a;
a=temp;
}
cout<<"从大到小排列的顺序为:"<<a<<","<<b<<","<<c<<endl;
return 0;
}