Is there a way I can sort 3 integers using only the ternary operator and the usual <, <=, >, >=, ==, != ? My prof wants it for 4 integers, but I can't seem to figure out how to compare 3 digits with just the ternary operator and the above comparisons (I'm not supposed to use if else at all). Any help (I'm hoping that if I see a 3 integer comparison, I can figure out a 4 integer comparison)? It seems like I can't compare more than 2 values in one ternary operator. For example, the following code doesn't seem to work:
Does this mean that I can't embed one ternary operator into another? What are its restrictions? I'm totally lost here...Code:(a > b > c > d) ? (cout<<a <<b <<c <<d) : (b > c > d > a)? (cout<< b <<c <<d <<a) : (c > d > a > b) ? (cout<<c <<d <<a <<b) : (d > a > b > c)? (cout <<d <<a <<b <<c) : (cout << "=[" <<endl);
sorry for messing up the page =[