Can't total up the results calculted...

i am doing a sales commission program to run a counter on the commission calculated, but the answers can't show on the counter

here's what i've done so far:
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main ()
{
int i;
double salary = 0;
double gross[10];
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
int count6 = 0;
int count7 = 0;
int count8 = 0;
int count9 = 0;
int numCounter = 0;

for (i=0; i<10; i++)
{
cout << "\nPlease enter the gross sales that you have made for the week: " << endl;
cin >> gross[i];

salary = 200 + (0.0900 * gross[i]) ;

cout << "\nYour commission for the week: " << salary << endl;
}

numCounter = 0;
while(numCounter <= 10)
{
salary = gross[numCounter];

salary = 200 + (0.0900 * gross[i]) ;

if (salary >= 200 && salary <= 299)
count1 += 1;

else

if (salary >= 300 && salary <= 399)
count2 += 1;

else

if (salary >= 400 && salary <= 499)
count3 += 1;

else

if (salary >= 500 && salary <= 599)
count4 += 1;

else

if (salary >= 600 && salary <= 699)
count5 += 1;

else

if (salary >= 700 && salary <= 799)
count6 += 1;

else

if (salary >= 800 && salary <= 899)
count7 += 1;

else

if (salary >= 900 && salary <= 999)
count8 += 1;

else

if (salary >= 1000)
count9 += 1;

else

cout << " " << endl;

numCounter += 1;
}

cout << "(a) $200 - $299 :" << count1 << endl;
cout << "\n(b) $300 - $399 :" << count2 << endl;
cout << "\n(c) $400 - $499 :" << count3 << endl;
cout << "\n(d) $500 - $599 :" << count4 << endl;
cout << "\n(e) $600 - $699 :" << count5 << endl;
cout << "\n(f) $700 - $799 :" << count6 << endl;
cout << "\n(g) $800 - $899 :" << count7 << endl;
cout << "\n(h) $900 - $999 :" << count8 << endl;
cout << "\n(i) $1000 and over :" << count9 << endl;
}
1
2
salary = 200 + (0.0900 * gross[i]) ;
warning: array subscript is above array bounds [-Warray-bounds]
Please take a pensil and a paper and calculate what will be the value of the expression salary = 200 + (0.0900 * gross[i]) ;
Topic archived. No new replies allowed.