# making comparison between two or more than two numbers

This is a discussion on making comparison between two or more than two numbers within the C++ Programming forums, part of the General Programming Boards category; Hi I'm writing an algorithm where I need to make comparison between four numbers X, Y, Z, and W to ...

1. ## making comparison between two or more than two numbers

Hi

I'm writing an algorithm where I need to make comparison between four numbers X, Y, Z, and W to arrange them in a descending order.

Get the numbers X, Y, Z, and W
Make Comparison between X, Y, Z, and W
Show the largest of four
Compare the remaining three numbers
.
.
.
Stop

I have a feeling this is not a correct algorithm. What is your opinion? Could you please help me? First I need to write an algorithm, implementation would be next step. Thanks.

2. Google for "sorting algorithm". Normally these things work better on arrays than on distinct variables - simply copy the value of X to data[0], Y to data[1], etc and sort the array named data.