Heres the part of the code That i have:
#include <iostream>
using namespace std;
const int NUM_DIV = 6; //Number of divisions
const int NUM_QTRS = 4; //Number of quarters
void divisionSales(double [][NUM_QTRS], int);
void divisionChange(double [][NUM_QTRS], int);
void quarterSales(double [][NUM_QTRS], int);
void quarterChange(double [][NUM_QTRS], int);
int main()
{
double sales[NUM_DIV][NUM_QTRS]; //Array for the sales.
int div, qtrs; //loop counters
//Loop to get sales values
for (div = 0; div < NUM_DIV; div++)
{
for (qtrs = 0; qtrs < NUM_QTRS; qtrs++)
{
cout << "Division " << (div + 1);
cout << ", Quarter " << (qtrs + 1) << ": $";
cin >> sales[div][qtrs];
while (sales[div][qtrs] < 0)
{
cout << "ERROR: Please enter a possitive number for sales figures.";
cin >> sales[div][qtrs];
}
}
cout << endl; //print blank line
}
divisionSales(sales, NUM_DIV);
divisionChange(sales, NUM_DIV);
quarterSales(sales, NUM_DIV);
return 0;
}
//loop to print the sales numbers by division
void divisionSales(double sales[][NUM_QTRS], int div)
{
double divSales = 0;
for (int x = 0; x < div; x++)
{
for (int y = 0; y < NUM_QTRS; y++)
divSales += sales[x][y];
cout << "Division " << (x + 1) << " Total Sales: $"
<< divSales << endl;
divSales = 0;
}
cout << endl;
}
void divisionChange(double sales[][NUM_QTRS], int div)
{
for (int x = 0; x < div; x++)
{
for (int y = 1; y < NUM_QTRS; y++)
{
cout << "For division " << (x+1) << " there was a "
<< (sales[x][y+1] - sales[x][y]) << " difference between "
<< "quarters " << (y +1) << " and " << y << endl;
}
cout <<endl;
}
}
here is the outcome of my work:
Division 1, Quarter 1: $14
Division 1, Quarter 2: $52
Division 1, Quarter 3: $41
Division 1, Quarter 4: $52
Division 2, Quarter 1: $41
Division 2, Quarter 2: $52
Division 2, Quarter 3: $41
Division 2, Quarter 4: $52
Division 3, Quarter 1: $41
Division 3, Quarter 2: $52
Division 3, Quarter 3: $41
Division 3, Quarter 4: $52
Division 4, Quarter 1: $41
Division 4, Quarter 2: $52
Division 4, Quarter 3: $41
Division 4, Quarter 4: $52
Division 5, Quarter 1: $41
Division 5, Quarter 2: $52
Division 5, Quarter 3: $41
Division 5, Quarter 4: $52
Division 6, Quarter 1: $41
Division 6, Quarter 2: $52
Division 6, Quarter 3: $41
Division 6, Quarter 4: $52
Division 1 Total Sales: $159
Division 2 Total Sales: $186
Division 3 Total Sales: $186
Division 4 Total Sales: $186
Division 5 Total Sales: $186
Division 6 Total Sales: $186
For division 1 there was a -11 difference between quarters 2 and 1
For division 1 there was a 11 difference between quarters 3 and 2
For division 1 there was a -11 difference between quarters 4 and 3
For division 2 there was a -11 difference between quarters 2 and 1
For division 2 there was a 11 difference between quarters 3 and 2
For division 2 there was a -11 difference between quarters 4 and 3
For division 3 there was a -11 difference between quarters 2 and 1
For division 3 there was a 11 difference between quarters 3 and 2
For division 3 there was a -11 difference between quarters 4 and 3
For division 4 there was a -11 difference between quarters 2 and 1
For division 4 there was a 11 difference between quarters 3 and 2
For division 4 there was a -11 difference between quarters 4 and 3
For division 5 there was a -11 difference between quarters 2 and 1
For division 5 there was a 11 difference between quarters 3 and 2
For division 5 there was a -11 difference between quarters 4 and 3
For division 6 there was a -11 difference between quarters 2 and 1
For division 6 there was a 11 difference between quarters 3 and 2
For division 6 there was a -52 difference between quarters 4 and 3
The bold is what i don't understand why i'm getting that answer. Also i know between Quarter 2 and 1 there is not a -11 difference. I know its as simple as changing one number or something, i just can't see it. Can someone provide me with another set of eyes?