+ 3

Any idea???

I wanna write a C++ program that reads 3 numbers & puts them in ascending order using if.else ,,can anyone give me some idea??

21st Jul 2017, 8:15 AM
RiGeL
RiGeL - avatar
2 Respuestas
+ 11
get a get b get c if a < b and a < c, smallest = a if b < a and b < c, smallest = b if c < a and c < b, smallest = c print smallest evaluate smallest, a : if b > c, print c, print b. else, print b, print c b : if a > c, print c, print a. else, print a, print c c : if a > b, print b, print a. else, print a, print b ***** ***** // or you can simply sort and store them into an array, then print the entire array.
21st Jul 2017, 8:23 AM
Hatsy Rei
Hatsy Rei - avatar