int a=3,b=5,c=6;
int max=0;
if(max max=a;
if(max max=b;
if(max
cout<
#include
using namespace std;
void compare(int a,int b,int c){
int *p1=&a;
int *p2=&b;
int *p3=&c;
if(*p1<*p2){
int *temp = p1;
p1=p2;
p2=temp;
}
if(*p1<*p3){
int *temp = p1;
p1=p3;
p3=temp;
}
if(*p2<*p3){
int *temp=p2;
p2=p3;
p3=temp;
if(*p1<*p2){
int* temp2=p1;
p1=p2;
p2=temp2;
}
}
cout<<*p1<<","<<*p2<<","<<*p3<
int main(){
int a,b,c;
cout<<"请输入三个不同的整数";
cin>>a;
cin>>b;
cin>>c;
compare(a,b,c);
system("pause");
return 0;
}
新手,请大家看看
输入三个整数a,b,c,要求按由小到大的顺序输出
main()
{
int a,b,c,t;
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
{
t=a;
a=b;
b=t;
}
if(a>c)
{
t=a;
a=c;
c=t;
}
if(b>c)
{
t=b;
b=c;
c=t;
}
printf("%d,%d,%d",a,b,c)
}