What questions do you have about functions? The use of functions or the language syntax of them? At the top level, functions are like black boxes. You put in some values and it returns a value. From the main program, you don't know what they are doing, just what they need passed in and what you will be getting in return.
So, for this program. You will likely want a function that takes in the four user-inputted values and returns (or prints) which value was highest.
Also, in the code you posted, it looks as if they want you to use a function to get the user input. The function (getQuartlySales) takes in a string (like 'northwest') and returns a double (I assume the user input). So, roughly the function would look like:
double getQuartlySales( string strDivision )
{
double user_input;
cout << "Enter sales for " + strDivision;
cin >> user_input;
return user_input;
}
Thus this function can be used to get user input for any company. Then your main would look something like this (double-check syntax, I mostly write in Java):
int main(double Northeast,double Southeast,double Northwest,double Southwest)
{
// some code to get quartly sales from user
cout << "Enter Quartly sales for each divison."<<endl;
Northeast = getQuartlySales("Northeast");
Southeast = getQuartlySales("Southeast");
Northwest = getQuartlySales("Northwest");
Southwest = getQuartlySales("Southwest");
// Now, lets find the highest value!
// call your function, something like findHighestSales(ne,se,nw,sw)
// Give a shot writing this function and we can help you get it working
return 0;
}
Hope that helps a bit,
Tom
yes i understand that people just come on and think that some one will do there homework fro them i have put this together from scratch and we have covered if statements im just lost on using functions. thanks for the reply