I am having a tough time grasping functions =/ the book we use is pretty much useless.
My problems are
1) Knowing what to put into the function ( )
2) How to validate it ( nothing in the book about it)
Any help or ideas I will greatly love and enjoy.
"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."
#include <cstdlib>
#include <iostream>
using namespace std;
double getSales(double,double,double,double)
void findHighest()
void validate(double &)
int main(int argc, char *argv[])
{
return 0;
}
void validate(double)
{
while( num !=0) // cannot = 0
}
double getSales()
{
double Div_ne, Div_se, Div_nw, Div_sw;
cout << "Enter the Sales for the NE division\n";
cin >> Div_ne;
void validate(double &)
cout << "Enter the Sales for the SE division\n";
cin >> Div_se;
void validate(double &)
cout << "Enter the Sales for the NW division\n";
cin >> Div_nw;
void validate(double &)
cout << "Enter the Sales for the SW division\n";
cin >> Div_sw;
void validate(double &)
}
findHighest()
{
cout << "Sales for the NE division are: " << Div_ne << endl;
cout << "Sales for the SE division are: " << Div_se << endl;
cout << "Sales for the NW division are: " << Div_nw << endl;
cout << "Sales for the SW division are: " << Div_sw << endl;
}