Sorting 3 integers in C language
Solved
sophie85
-
sophie85 -
sophie85 -
Bonjour,
I want to sort 3 integers in ascending order
when I input for example 5 8 3
the result is not 3 5 8 but 0 0 0
could you look at my code and tell me where the problem is
thank you :)
I want to sort 3 integers in ascending order
when I input for example 5 8 3
the result is not 3 5 8 but 0 0 0
could you look at my code and tell me where the problem is
thank you :)
int a,b,c,p; cout<<"Please enter 3 numbers:\n"; cin>>a>>b>>c; if(c<a) p=c; c=a; a=p; if(b<a) p=b; b=a; a=p; if(c<b) p=c; c=b; b=p; cout<<a<<b<<c<<"\n";
Configuration: Windows Vista Internet Explorer 7.0