Hey guys, if someone can help me on this one, I'd be thankful. The thing is that this is a sample work. I gotta do the same thing but with 4 variables, organize them according to the correct order, from lowest to greatest or viceversa, it doesn't matter. And I can't use logical operators, that's another thing. Hope you get what I'm trying to do, here's the code:
#include <iostream>
#include <string>
using namespace std;
int main(){
int x, y, z;
int max, mid, min;
cin>>x>>y>>z;
if(x>y){
if(x>z){
max = x;
if(y>z){
mid = y;
min = z;
}else{
mid = z;
min = y;
}
}else{
//x>y, z>x, z>y
max = z;
mid = x;
min = y;
}
}else{
//y>x
if(y>z){
max = y;
if(x>z){
mid = x;
min = z;
}else{
mid = z;
min = x;
}
}else{
//y>x, z>y, z>x
max = z;
mid = y;
min = x;
}
}
cout<<"Max: "<<max<<endl;
cout<<"Mid: "<<mid<<endl;
cout<<"Min: "<<min<<endl;
int stop;
cin>>stop;
return 0;
}