Hey guys, i recently got this assignment and im just at a total loss where to start (too much work lately, my brain is dying). Here is is the problem:
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 division's quarterly sales figure, validates the input then returns a valid sales figure for that quarter. 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.
Do not accept dollar amounts less than 0.
I currently have this, but im not sure what to do with it, It's working fine in the sense that its getting the values, but i don't know how to use the getsales () function with the findhighest () function so it finds the highest value. I would appreciate any clue at this point. Sorry for such an open ended question :(
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <cstdlib>
#include <iostream>
using namespace std;
double getsales (double);
int main(int argc, char *argv[])
{
double northeast = 0;
double southeast = 0;
double northwest = 0;
double southwest = 0;
cout << "Enter NorthEast sales: $" ;
cout << getsales(northeast) << endl << endl;
cout << "Enter SouthEast sales: $";
cout << getsales(southeast) << endl << endl;9
cout << "Enter NorthWest sales: $";
cout << getsales(northwest) << endl << endl;
cout << "Enter SouthWest sales: $";
cout << getsales(southwest) << endl << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
double getsales (double num)
{
cin >> num;
return num;
}
|