yes ehm sorry david , i kande missed your post, but i was replying to the guy i quoted :P
ok this is what im trying now :
Code:
void earningslog::Setearnings (float procentless[])
{
const int frequencysize = 9;
int frequency[frequencysize] = {0};
for (int x = 0; x < employees ; x++)
{
float sub = procentless[x]*0.09;
totalearnings[x] = ( sub + 200 );
if ( (totalearnings[x] ) > 1000)
{
frequency[8]++;
}
else
{
const float test = 0.50;
float sub = totalearnings[x]/100;
cout << sub <<"\t"<< (int)sub << endl;
frequency[(int)sub]++;
}
}
outputbar (frequency);
}
void earningslog::outputbar (int frequency [])
{
int x = 0;
int y = 200;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+= 100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<y <<"-"<<y+99 <<": " << frequency[x] << endl;
x++,y+=100;
cout <<"1000 and over:"<< frequency[x] << endl;
}
output:
Code:
E:\PROJECTMAP\test\tests\windows\Debug_Build\tests.exe
2.9 2
3.35 3
3.8 3
4.25 4
4.7 4
5.15 5
5.6 5
5.6 5
6.5 6
6.95 6
8.3 8
9.2 9
4.7 4
7.4 7
9.9992 9
8.9993 8
7.9994 7
6.9995 6
5.9996 5
200-299: 0
300-399: 0
400-499: 1
500-599: 2
600-699: 3
700-799: 4
800-899: 3
900-999: 2
1000 and over:3
im sorry but i got to go to bed now i tought that i might use const float test = 0.50 and compare the sub numbers if their digets after the . are higher than zero, but well ...
i made a loop in it printing sub and the integer cast to it
ill look further tomorrow got to sleep now
tnx guys
( i changed totalearnings to the type as float)