Hi everyone! So I can't seen to get this program to compile and run. THis is exactly what I'm shooting to do:
This program should calculate which division in a company had the greatest sales
for a quarter. It should use the following functions:
- A function should ask the user for and return the quarterly sales
figures for the company's Northeast, Southeast, Northwest, and Southwest divisions. - A function should determine which division had the highest sales figures.
A message should be displayed indicating the leading division and its sales
figures for the quarter.
So I can't figure why this program won't compile any suggestions? Here is the code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// Function Prototypes
float division_input(string);
void highest_division(float, float, float, float);
int main()
{
cout << "This program written for cs102 Online." << endl;
float nE, sE, nW, sW;
nE = division_input( "North East" );
sE = division_input( "South East" );
nW = division_input( "North West" );
sW = division_input( "South West" );
highest_division(nE, sE, nW, sW); // Also prints the result
}
// *********Subroutine definitions below**********
float division_input
{
float quarter_sales = -1;
while (quarter_sales < 0)
{
cout << "Enter the quarterly sales for " << division << "division: $";
cin >> quarter_sales;
if (quarter_sales < 0)
cout << "\nPlease enter a positive amount!";
}
return quarter_sales;
}
void highest_division (float nE, float nW, float sE, float sW)
{
float highest_sales = nE;
string greatest_division;
greatest_division = "Northeast";
if (nE > highest_sales)
{
highest_sales = nW;
greatest_division = "Northwest";
}
if (sW > highest_sales)
{
highest_sales = sW;
greatest_division = "Southwest";
}
if (sE > highest_sales)
{
highest_sales = sE;
greatest_division = "Southeast";
}
cout << "\n\n The" << greatest_division << "division of the company had the highest\n"
cout << " quarterly sales of $ ";
cout << setprecision(4) << fixed;
cout << highest_sales << endl;
}
system("PAUSE");
return 0;
}