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
|
#include <iostream>
#include <string>
using namespace std;
void monthlysales(unsigned int*, unsigned int, unsigned int);
const unsigned int x = 12;
const unsigned int z = 3;
const string year[z] =
{"Year 1","Year 2","Year 3",};
const string months[x] =
{"Janurary ","Feburary ","March ",
"April ","May ","June ",
"July ","August ","September",
"October ","November ","December "};
int main()
{
unsigned int totalbooksold[x][z];
monthlysales(totalbooksold, x, z);
system("pause");
return 0;
}
void monthlysales(unsigned int booksoldmonthly[x][z], unsigned int y, unsigned int s)
{
for (int i = 0; i < x; i++)
{
cout << "Enter the amount of book sold for " << months[i]
<< " of " << year[0] << ": ";
cin >> booksoldmonthly[i][s-3];
}
for (int i = 0; i < x; i++)
{
cout << "Enter the amount of book sold for " << months[i]
<< " of " << year[1] << ": ";
cin >> booksoldmonthly[i][s-2];
}
for (int i = 0; i < x; i++)
{
cout << "Enter the amount of book sold for " << months[i]
<< " of " << year[2] << ": ";
cin >> booksoldmonthly[i][s-1];
}
return;
}
|