Program that finds the middle number
What I'm trying to do is write a program to find the middle number of 3 sets of variables entered. I'm starting off doing it in basic fashion , not advanced using fuctions etc. This is the code I have so far, but when I excute the program returns no answers.
Code:
#include <iostream>
using namespace std;
//1,2,3
int main()
{
int a,b,c;
cout << " Enter number " << endl;
cin >>a;
cout << " Enter 2nd number " << endl;
cin >>b;
cout << " Enter 3rd number " << endl;
cin >>c;
if (a > b && a < c)
cout <<b<< " middle number" << endl;
else if (c > a && c < b)
cout <<a<< " middle number" << endl;
else if (b > c && b < a)
cout <<c<< " middle number" << endl;
system("pause");
return 0;
}