I am trying to write a program that compares 3 numbers with the output labeling high, med,and low. It works for the highest and lowest, but I am having challenges trying to figure out how to calculate for the medium.
Here is my program. In the third function it grabs what 'a' is. It ignores my if...
#include "stdafx.h"
#include <iostream>
using namespace std;
double larger(double a, double b, double c);
double lowest(double a, double b, double c);
double medium(double a, double b, double c);
int main()
{
double one, two, three;
cout << "Enter three numbers: \n";
cin >> one >> two >> three;
cout << endl;
It does not ignore your if; the problem is that there is no code to be executed when the if is found to be true. After an if statement, the semi-colon marks the END of the code to be executed when the if is found to be true.
if (a < larger(a, b, c) && a > lowest(a, b, c));
I'll add a bit to your line of code to show you the code that is executed when the if is found to be true:
if (a < larger(a, b, c) && a > lowest(a, b, c)) */ HERE IS THE CODE THAT IS EXECUTED - THERE IS NOTHING HERE */ ;