I can't get it to compile.
Here are the instructions for the assignment:
Write a program that determines which of a company’s four divisions (Northeast,
Southeast, Northwest, and Southwest) had the greatest sales for a quarter. It should
include the following two functions, which are called by main.
• double getSales() is passed the name of a division. It asks the user for a divi-
sion’s quarterly sales figure, validates the input, then returns it. It should be called
once for each division.
• void findHighest() is passed the four sales totals. It determines which is the
largest and prints the name of the high grossing division, along with its sales figure.
Input Validation: Do not accept dollar amounts less than $0.00.
I'm not looking for anyone to do my homework...just help if you can. Thank you for looking.
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
const int NAME_SIZE = 26;
double getSales (char []);
void findHighest(double, double, double, double);
int main()
{
double input_div(string);
double salesNE,
salesSE,
salesNW,
salesSW;
salesNE = getSales("Northeast");
salesSE = getSales("Southeast");
salesNW = getSales("Northwest");
salesSW = getSales("Southwest");
findHighest( salesNE, salesSE, salesNW, salesSW);
cout << "Enter the quarterly sales for the Northeast division: ";
cin >> salesNE;
while (salesNE <=0)
{
cout << "Sales must be a non-negative number.";
cout << "Enter the quarterly sales for the Northeast division: ";
cin >> salesNE;
}
cout << "Enter the quarterly sales for the Southeast division: ";
cin >> salesSE;
while (salesSE <=0)
{
cout << "Sales must be a non-negative number.";
cout << "Enter the quarterly sales for the Southeast division: ";
cin >> salesSE;
}
cout << "Enter the quarterly sales for the Northwest division: ";
cin >> salesNW;
while (salesNW <=0)
{
cout << "Sales must be a non-negative number.";
cout << "Enter the quarterly sales for the Northwest division: ";
cin >> salesNW;
}
cout << "Enter the quarterly sales for the Southwest division: ";
cin >> salesSW;
while (salesSW <=0)
{
cout << "Sales must be a non-negative number.";
cout << "Enter the quarterly sales for the Southwest division: ";
cin >> salesSW;
}
}
void findHighest(double salesNE, double salesSE, double salesNW, double salesSW)
{
string highest, name;
highest = "salesNE";
name = "Northeast";
if(salesSE > highest)
{
highest = "salesSE";
name = "Southeast";
}
if(salesNW > highest)
{
highest = "salesNW";
name = "Northwest";
}
if(salesSW > highest)
{
highest = "salesSW";
name = "Southwest";
}
cout << "The highest division is " << name << " with $" << highest << endl;
}
return 0;
}