The last function displayHighest won't output any numbers higher than double digits
#include <iostream>
#include <iomanip>
using namespace std;
double getSales ( );
void findHighest (double northSales, double southSales, double eastSales, double westSales,
double & highestSales);
void displayHighest(double highestSales, double northSales, double southSales,
double westSales, double eastSales);
int main ()
{
double northSales,southSales, eastSales, westSales, highestSales, displayHighest, salesValue;
cout << "Enter North ";
northSales = getSales ();
cout << "Enter South ";
southSales = getSales ();
cout << "Enter East ";
eastSales = getSales ();
cout << "Enter West ";
westSales = getSales ();
findHighest (northSales, southSales, eastSales, westSales, highestSales);
displayHighest (highestSales, northSales, southSales, westSales,
eastSales);
system ("pause");
return 0;
}
double getSales ( )
{
double salesValue;
cout << "division quarterly sales: ";
cin >> salesValue;
return salesValue;
}
void findHighest (double northSales, double southSales, double eastSales, double westSales,
double & highestSales)
{
if (northSales > southSales && northSales > eastSales && northSales > westSales)
highestSales = northSales;
else if (southSales > northSales && southSales > eastSales && southSales > westSales)
highestSales = southSales;
else if (eastSales > northSales && eastSales > southSales && eastSales > westSales)
highestSales = eastSales;
else if (westSales > northSales && westSales > southSales && westSales > eastSales)
highestSales = westSales;
}
void displayHighest (double highestSales,double northSales, double southSales, double westSales,
double eastSales)
{
if (highestSales == northSales)
cout << "Northern Division has the Highest Quarterly Sales being:"
<< northSales;
else if (highestSales == southSales)
cout << "Southern Division has the Highest Quarterly Sales being: "
<< southSales;
else if (highestSales == eastSales)
cout << "Eastern Division has the highest quarteryl sales being: "
<< eastSales;
else if (highestSales == westSales)
cout << "Western Division has the highest quarterly sales being: "
<< westSales;
}
Well your coded didn't compile until I removed the displayHighest
variable in main()
. But after that it displayed values as expected.