I have been a histogram assignments to do in C++ although i kno how to do in Visual Basic.
I have tried to do it in C++ but it seems ive missed out a few steps.
below is what i have done so far, please correct me where am wrong. thank Ellie
The program should allow the tutor to enter in the various marks which the students have been awarded, until the tutor enters in a mark exceeding 100. At this point the program should display a histogram. Each star represents a student who achieved a module mark in the range shown.
This is an example of the output. The example below shows the distribution of marks for 20 students. Your program should work with any number of student marks entered.
0-29 ***
30-39 *****
40-69 ********
70-100 ****
20 students in total.
• As the tutor enters each mark, a counter should count the number of student’s marks which have been entered.
• Use the same 4 category ranges shown here.
• Make sure the display is neatly formatted as above.
• Your program should make use of ‘loops’ for the display of each category.
#include <iostream>
using namespace std;
int main ()
{
int Grade1 = 0-29;
int Grade2 = 30-39;
int Grade3 = 40-69;
int Grade4 = 70-100;
int Mark = 0;
int Totalmark = 0;
while (Mark <= 100)
cout<< Grade1<< endl;
(Mark >= 0 && Mark <= 29)
Grade1 = Grade1 + 1 // am finding a problem on this line
Totalmark = Marks + Totalmark
return 0;
}