+ 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??
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.