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 95 96 97 98 99 100 101 102 103 104 105 106 107
|
// Reaper
#include <iostream>
using namespace std;
struct CorpData
{
string north,
south,
east,
west;
float FirstQuartSales,
SecondQuartSales,
ThirdQuartSales,
FourthQuartSales,
TotalAnnualSales,
AvgQuartSales;
CorpData (string n, string s, string e, string w, float a, float b, float c, float d)
{
north = n;
south = s;
east = e;
west = w;
FirstQuartSales = a;
SecondQuartSales = b;
ThirdQuartSales = c;
FourthQuartSales = d;
}
};
void FindTotal(CorpData x)
{
float total;
total = x.FirstQuartSales + x.SecondQuartSales + x.ThirdQuartSales + x.FourthQuartSales;
x.TotalAnnualSales = total;
return;
}
void FindAverage(CorpData y)
{
float average;
average = (y.FirstQuartSales + y.SecondQuartSales + y.ThirdQuartSales + y.FourthQuartSales) / 4;
y.AvgQuartSales = average;
return;
}
int main()
{
CorpData north{"North", north.FirstQuartSales, north.SecondQuartSales, north.ThirdQuartSales, north.FourthQuartSales};
CorpData south{"South", south.FirstQuartSales, south.SecondQuartSales, south.ThirdQuartSales, south.FourthQuartSales};
CorpData east{"East", east.FirstQuartSales, east.SecondQuartSales, east.ThirdQuartSales, east.FourthQuartSales};
CorpData west{"West", west.FirstQuartSales, west.SecondQuartSales, west.ThirdQuartSales, west.FourthQuartSales};
cout << "The will calculate and display quarterlys.\n\n";
cout.setf(ios_base::fixed , ios_base::floatfield);
cout.precision(2);
cout << "North Division" << endl;
cout << "Enter first quarter sales: $";
cin >> north.FirstQuartSales;
cout << "Enter second quarter sales: $";
cin >> north.SecondQuartSales;
cout << "Enter third quarter sales: $";
cin >> north.ThirdQuartSales;
cout << "Enter fourth quarter sales: $";
cin >> north.FourthQuartSales;
cout << "\nSouth Division" << endl;
cout << "Enter first quarter sales: $";
cin >> south.FirstQuartSales;
cout << "Enter second quarter sales: $";
cin >> south.SecondQuartSales;
cout << "Enter third quarter sales: $";
cin >> south.ThirdQuartSales;
cout << "Enter fourth quarter sales: $";
cin >> south.FourthQuartSales;
cout << "\nEast Division" << endl;
cout << "Enter first quarter sales: $";
cin >> east.FirstQuartSales;
cout << "Enter second quarter sales: $";
cin >> east.SecondQuartSales;
cout << "Enter third quarter sales: $";
cin >> east.ThirdQuartSales;
cout << "Enter fourth quarter sales: $";
cin >> east.FourthQuartSales;
cout << "\nWest Division" << endl;
cout << "Enter first quarter sales: $";
cin >> west.FirstQuartSales;
cout << "Enter second quarter sales: $";
cin >> west.SecondQuartSales;
cout << "Enter third quarter sales: $";
cin >> west.ThirdQuartSales;
cout << "Enter fourth quarter sales: $";
cin >> west.FourthQuartSales;
return 0;
}
| |