0

I need to extract the middle numeric number.

It works for two order of numbers, for example:

when I enter the numbers in this order

12, 14,6 it works...when I enter in this order 12, 6, 14 it works as well, but when I enter in this order 14, 12, 6 it doesn't work.

Any suggestions?

see the code below:

int a, b, c; //user input

int d;//sum of largest and smallest

int sum; // total of all numbers entered by user

int midnum; //numeric middle number

cout << "enter three numbers \n";

cin >> a >> b >> c;

sum = a + b + c;

if ( a > b )

cout << a;

cout <<"\n";

if ( b > c )

cout << b << "\n";

if ( c < a)

cout << c << "\n" "\n";

d = b + c;

midnum = sum - d;

cout << "The middle number in numeric order is: " << midnum << "\n";