Alright, i'm quite new to c++ and having some trouble with an assignment. Just looking for any advice or a push in the right direction. I'm quite confused about outputting the function data to the output file, as well as the array portion of everything. The assignment is:
Write a program that uses a structure to store and then process the following data on a
Hubbly’s company division :
Division ( East , West , North , South )
Quarter ( 1 , 2 , 3 , 4 )
Quarterly Sale.
The program should have an array of 16 structures to hold the data for the company.
When the program suns, it should perform the following tasks :
1. Load the data from the CompanySales.txt file. This process is done in the
main Program.
2. From main, Call a function to calculate and print the total corporate
sales for each quarter. You must pass the structure and the array to the
function.
3. From main , Call a function to calculate and print the yearly sales for
each division. You must pass the structure and the array to the function.
4. From main , Call a function to calculate and print the minimum and
maximum yearly sales. You must pass the structure and the array to the
function.
5. From main , Call a function to calculate and print the yearly corporate
sales. You must pass the structure and the array to the function.
So far I have:
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
|
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
struct companyData
{
string region;
int regionNumber;
int salesNumber;
};
void quarterOutput(companyData);
void regionOutput(companyData);
void minimumMaximum(companyData);
void yearlySale(companyData);
int main()
{
ifstream fin;
ofstream fout;
fin.open("companySales.txt");
fout.open("salesOut.txt");
int arrayData [10];
companyData files;
quarterOutput(files);
regionOutput(files);
minimumMaximum(files);
yearlySale(files);
fin.close();
fout.close();
return 0;
}
void quarterOutput(companyData file)
{
cout << "Total Sale for Quarter 1 is: " << endl;
cout << "Total Sale for Quarter 2 is: " << endl;
cout << "Total Sale for Quarter 3 is: " << endl;
cout << "Total Sale for Quarter 4 is: " << endl;
cout << endl;
}
void regionOutput(companyData file)
{
cout << "Total Sale for East is: " << endl;
cout << "Total Sale for West is: " << endl;
cout << "Total Sale for North is: " << endl;
cout << "Total Sale for South is: " << endl;
cout << endl;
}
void minimumMaximum(companyData file)
{
cout << "Minimum Sales happened in the " << endl;
cout << "Maximum Sales happened in the " << endl;
cout << endl;
}
void yearlySale(companyData file)
{
cout << "The Yearly Corporate Sale is " << endl;
}
|
Thanks in advance for anything.