I need help with functions

I`m a first year programmer and I don`t understand functions really well other than using void functions that don`t return a given value to its parameters.
Im doing a lab that tells me to do the following and right now I am just trying to work on getting the input right:

Write a program that determines which of a company`s four divisions(Northwest, Southeast, Northwest, and Southwest) had the greatest sales for a quarter. These two functions should be included that do the following.

double getSales() is passed the name of a division.It asks the user for a division`s quarterly sales figure, validates that the input is not less than 0, than 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.

It is a mess but right now here is the code I have so far.

#include <iostream>
#include <string>
using namespace std;



double getSales(double num1, double num2, double num3, double num4);//prototype function

int main()
{
do
{
char repeat, repeat_challenge;//declared variables for navigation
int choice;


//navigational menu
cout << "Welcome. Please choose which challenge you want to run.\n";
cout << "1. Winning Division\n";
cin >> choice;

if (choice == 1)
/*
Challenge 1: Write a program that determines which of a company`s four divisions (NE, SE, NW, SW) had the greatest sales for a quarter.
Include these functions called by main. double getSales and findHighest.
*/
do
{


int ne, se, nw, sw;
getSales();//function getSales is called
getSales(ne, se, nw, sw);
cout << "Would you like to repeat this challenge?\n";
cin >> repeat_challenge;
} while ((repeat_challenge == 'y') || (repeat_challenge == 'Y'));
cout << "Would you like to run the program again?\n";
cin >> repeat;
} while ((repeat == 'y') || (repeat == 'Y'));
return 0;

}

double getSales(double num1, double num2, double num3, double num4)
{
string division1 = "northeast", division2 = "southeast", division3 = "northwest", division4 = "southwest";

cout << "Please enter the quarterly sales figures for the " << division1 << " division" << endl;
cin >> num1;
while (num1 < 0)
{
cout << "Only a positive number please.\n";
cin >> num1;
}
cout << "Please enter the quarterly sales figures for the " << division2 << " division" << endl;
cin >> num2;
while (num2 < 0)//input validation for all divisions making sure the number is more than 0.
{
cout << "Only a positive number please.\n";
cin >> num2;
}
cout << "Please enter the quarterly sales figures for the " << division3 << " division" << endl;
cin >> num3;
while (num3 < 0)
{
cout << "Only a positive number please.\n";
cin >> num3;
}
cout << "Please enter the quarterly sales figures for the " << division4 << " division" << endl;
cin >> num4;
while (num4 < 0)
{
cout << "Only a positive number please.\n";
cin >> num4;
}

return (num1, num2, num3, num4);

}
I suggest that you try reading the chapters on functions in my book:

http://www.amazon.com/Programming-Beginners-C-Kevin-Compton/dp/1511806982/

There are several chapters explaining functions that return a value, and there are some more chapters that explain void functions (which would better be called procedures, but in C++ they are commonly called functions).
you can watch video tutorials of thenewboston form youtube for improving your concepts
Topic archived. No new replies allowed.