What up gang, Hay this is The Ski calling out to all you helpful and fine programmers out there in Wonderland, and my wonder of the night is what am I doing wrong with the arrays? I do pay attention in class but sometimes when you are in a class of 100 people sometimes you can get your questions answered and sometimes you cannot due to time contraints. But hay why worry when I have all you GREAT people to help me out. Anyways:
Enough of the jive talk from me. Here is a program I am working on and below that is my compiling errors. What am I doing wrong that the system will not let me compile the program?
//
//
//
//
// Nov 6, 2001
// This program is used to catigorize salary and commission to the a range of a payscale.
#include <iostream.h>
#include <iomanip.h>
const int arsize1 = 50;
const int arsize2 = 5;
using std::cout;
using std::cin;
using std::endl;
int main()
{
int num1[arsize1], num2[arsize2], num3[arsize1],num4[arsize1];
num1[arsize1] = 0;
num2[arsize2] = 0;
num3[arsize1] = 0;
num4[arsize1] = 0;
cout << "Please enter the gross sales amount (-1 to end):";
cin >> num1[0];
while ( num1[arsize1] != -1 )
{
for (int count1 = 0; count1 < arsize1; count1++ )
{
num3[count1] = num1[count1] * .09;
num4[count1] = num3[count1] + 200;
cout <<"The salary for that sales amount is: " << num4[count1] << endl;
if ( num4[count1] <= 399 )
num2[1] = num2[1] + 1;
else if (( num4[count1]>= 400) && (num4[count1] <= 599 )
num2[2] = num2[2] + 1;
else if (( num4[count1]>= 600) && (num4[count1] <= 799 )
num2[3] = num2[3] + 1;
else if (( num4[count1]>= 800) && (num4[count1] <= 999 )
num2[4] = num2[4] + 1;
else if ( num4[count1]>= 400)
num2[5] = num2[5] + 1;
}
}
cout << endl;
cout << "RESULTS!" << endl;
cout << endl;
cout << num2[1] << " people fell into the range of 200 to 399" << endl;
cout << num2[2] << " people fell into the range of 400 to 599" << endl;
cout << num2[3] << " people fell into the range of 600 to 799" << endl;
cout << num2[4] << " people fell into the range of 800 to 999" << endl;
cout << num2[5] << " people fell into the range of 1000 and up" << endl;
return 0;
}
ERRORS:
prog_19.cpp: In function `int main()':
prog_19.cpp:34: warning: assignment to `int' from `double'
prog_19.cpp:40: parse error before `['
prog_19.cpp:59: confused by earlier errors, bailing out
Now the one error I think I may know because I am dealing with multiply by .09. Do I have to include the math library? And what do I have to do to avoid outputting a double variable, just keeping it as a regular integer?