/********************************************************************************************
1122.cpp
Jim Millard
for CO211/Fall 1999
Program that takes three input values and returns the largest of the three
********************************************************************************************/
#include <iostream>
#include <string>
using namespace std;
float PromptAndGet(const string&);
float largestOfThree(float, float, float);
int main()
{
cout << "This program will tell you the largest of three input values." << endl;
float a = PromptAndGet("Please enter the first value");
float b = PromptAndGet("Please enter the second value");
float c = PromptAndGet("Please enter the last value");
cout << "The biggest value is " << largestOfThree(a, b, c) << endl;
return 0;
}
float PromptAndGet(const string& prompt)
{
float temp;
cout << prompt << ": ";
cin >> temp;
return temp;
}
float largestOfThree(float first, float second, float third)
{
float largest = first;
if (largest < second)
largest = second;
if (largest < third)
largest = third;
return largest;
}