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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <stdlib.h>
using namespace std;
// Global Variables
string ne = "Northeast",
se = "Southeast",
nw = "Northwest",
sw = "Southwest";
double north_east,
south_east,
north_west,
south_west;
// Function Prototypes
double getSales(string division);
void findHighest(double, double, double, double);
int main()
{
cout << "================================" << endl;
cout << " Winning Division " << endl;
cout << "================================" << endl;
cout << endl << endl;
cout << "Division Sales: ";
cout << endl << endl;
// Calling on Input Function
north_east = getSales(ne);
south_east = getSales(se);
north_west = getSales(nw);
south_west = getSales(sw);
cout << endl << endl;
void findHighest (double north_east, double south_east, double north_west, double south_west);
}
// Input Function
double getSales(string division)
{
double sales;
do
{
cout << "Enter " << division << " Divsion Quartely Sales: $ ";
cin >> sales;
} while (sales < 0.0);
return sales;
}
// Output Function
void findHighest (double north_east, double south_east, double north_west, double south_west)
{
double highest_sales = north_east;
string highest_division = "Northeast";
if (south_east >= highest_sales)
{
highest_sales = south_east;
highest_division = "Southeast";
}
if (north_west >= highest_sales)
{
highest_sales = north_west;
highest_division = "Northwest";
}
if (south_west >= highest_sales)
{
highest_sales = south_west;
highest_division = "Southwest";
}
cout << endl << endl;
}
| |