So i am doing a program that opens a file that contains grades and shows the average, total, etc..
But at the end I am supposed to make a histogram that would look something like this
A= * *
B= * * *
C= * * * * * * *
D= * * * * *
F= * * *
So lets say that from the file i can see that 2 grades were in the A range, 3 in the B range and so on!
This is what ive been doing but i dont get any luck
// Part of code
int A= 0 ,
B=0,
C=0,
D=0,
F=0;
{
if ( grade>= 90 && grade <=100)
A++;
for (int h = 0 ; h< A; h++)
cout << "*" << endl;
if ( grade> 80 && grade <=89)
B++;
for (int h = 0 ; h< B; h++)
cout << "*" << endl;
if ( grade> 70 && grade <=79)
C++;
for (int h = 0 ; h< C; h++)
cout << "*" << endl;
// and so on......
I get **** but theyre all next to each other.
I tried to put <<endl; but the would then show like this
*
*
*
*