0
How can i make this code shorter?
I want to make an increasing set which it receives 3 numbers and I want to make the code shorter #include <iostream> using namespace std; int main() { // Goal:make an increaing set. int a; int b; int c; int max,min,mid; cin>>a>>b>>c; if(a>b){ max=a; if(b>c){ mid=b; min=c; } else{ mid=c; min=b; } } if(b>a){ max=b; if(a>c){ min=c; mid=a; } else{mid=c; min=a;} } if(c>a){ max=c; if(a>b){ min=b; mid=a; } else{min=a; mid=b;} } cout<<"{"<<max<<","<<mid<<","<<min<<"}"; return 0; }
3 Answers
+ 1
Check this out đ
https://code.sololearn.com/cghGzO6OIYVx/?ref=app
+ 1
Im sorry but this is not what I have learned by now... thank you đ