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; }

30th Nov 2020, 8:46 AM
Ali_combination
Ali_combination - avatar
3 Answers
30th Nov 2020, 8:59 AM
Arsenic
Arsenic - avatar
+ 1
Im sorry but this is not what I have learned by now... thank you 👍
30th Nov 2020, 9:02 AM
Ali_combination
Ali_combination - avatar