### Highest division quarterly

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455`` ``````// Includes #include "stdafx.h" #include using namespace std; // Prototypes double getSales(double & quarterly); void findHighest(); //Main Funtion int main() { double quarterly; cout << "This will display the highest quarterly pay of 4 divisions.\n\n"; getSales(quarterly); cout << "\n\nThe highest division quarterly is \$" << endl; cout << endl << "Press ENTER to continue..."; cin.clear(); cin.sync(); cin.get(); return 0; } // Gets users input double getSales(double & quarterly) { float NE, SE, NW, SW; cout << "Enter northeast division quarterly pay: \$"; cin >> NE; cout << "Enter southeast division quarterly pay: \$"; cin >> SE; cout << "Enter northwest division quarterly pay: \$"; cin >> NW; cout << "Enter southwest division quarterly pay: \$"; cin >> SW; while ( NE < 0 || SE < 0 || NW < 0 || SW < 0 ) { cout << "Please re-enter your pay quarterlys, they must be greater than 0.\n\n"; cout << "Enter northeast division quarterly pay: \$"; cin >> NE; cout << "Enter southeast division quarterly pay: \$"; cin >> SE; cout << "Enter northwest division quarterly pay: \$"; cin >> NW; cout << "Enter southwest division quarterly pay: \$"; cin >> SW; } return quarterly; }``````

Heres my code so far, everythings works, now i need this part of my exercise done, and its alittle confusing.

the last part says

Function void findHighest() is passed the four sales totals. It determines which division is the largest and prints the name of the highest grossing division, along with its sales figure.

Whats confusing is how i would make that function then get the function to determine which division has the largest pay.

The four division are Northeast, Southeast, Northwest, and Southwest.

Any ideas.
I doubt you getSales() function is working because you don't modify the input argument quarterly. If I understand well your function should take four float and fill them with user unput but your function does nothing with the input.
ok, how would i fix that and make the void findHighest() function.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172`` ``````// Includes #include "stdafx.h" #include using namespace std; // Prototypes double getSales(double & quarterly); //void findHighest(); //Main Funtion int main() { double quarterly; cout << "This will display the highest quarterly pay of 4 divisions.\n\n"; cout.setf(ios_base::fixed , ios_base::floatfield); cout.precision(2); getSales(quarterly); cout << endl << "Press ENTER to continue..."; cin.clear(); cin.sync(); cin.get(); return 0; } // Gets users input double getSales(double & quarterly) { float NE, SE, NW, SW; cout << "Enter northeast division quarterly pay: \$"; cin >> NE; cout << "Enter southeast division quarterly pay: \$"; cin >> SE; cout << "Enter northwest division quarterly pay: \$"; cin >> NW; cout << "Enter southwest division quarterly pay: \$"; cin >> SW; while ( NE < 0 || SE < 0 || NW < 0 || SW < 0 ) { cout << "Please re-enter your pay quarterlys, they must be greater than 0.\n\n"; cout << "Enter northeast division quarterly pay: \$"; cin >> NE; cout << "Enter southeast division quarterly pay: \$"; cin >> SE; cout << "Enter northwest division quarterly pay: \$"; cin >> NW; cout << "Enter southwest division quarterly pay: \$"; cin >> SW; } if ( NE > SE && NE > NW && NE > SW ) cout << "\n\nNortheast division has the highest quarterly of \$" << NE << endl; else if ( SE > NE && SE > NW && SE > SW ) cout << "\n\nSoutheast division has the highest quarterly of \$" << SE << endl; else if ( NW > NE && NW > SE && NW > SW ) cout << "\n\nNorthwest division has the higest quareterly of \$" << NW << endl; else cout << "\n\nSouthwest division has the highest quarterly of \$" << SW << endl; return 1; } // Find Highest quarterly function void findHighest() { double quarterly; cout << getSales(quarterly) << endl; }``````

Here's my updated code.

eveerything works fine, but i need to know if my void findhighest() function is correct.

Remember i need the 4 division quarterlys passed to the findHighest function and that function is suppose to find the highest.
Last edited on
 i need the 4 division quarterlys passed to the findHighest function

Here I see your findHighest function takes no arguments so it can be right.

Plus, as I said earlier, what is the purpose of the quarterly argument of the getSales function if you don't modify or use it?

From what you said the prototype of getSales should be
 `` `` ``void getSales(double & NE, double& SE, double& NW, double& SW);``

and findHighest should be
 `` `` ``double findHighest(double NE, double SE, double NW, double SW);``
oh ok, i understand now, i see what you meant thank you.
Topic archived. No new replies allowed.