The University wants to make a basic graphical display to show how many people received different grades for a piece of work on a module. You are required to write a program in C++ that achieves this. The program is in a number of parts.
1. 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.

This is what i got so far.. ( its not running) :

cout<<"Enter marks for student"<<i+1;
            cin>>mark;

            if((mark>=0) && (mark<=29))
            grade[0]+ = 1;
            if((mark>=30) && (mark<=39))
            grade[1]+ = 1;
            if((mark>=40) && (mark<=69))
            grade[2]+ = 1;
            if((mark>=70) && (mark<=100))
            grade[3]+ = 1;
        }
        cout<<"0 - 29";
        for(i=0;i<grade[0];++i)
        cout<<"*";
        cout<<"\n";
        cout<<"30 - 39";
        for(i=0;i<grade[1];++i)
        cout<<"*";
        cout<<"\n";
        cout<<"40 - 69";
        for(i=0;i<grade[2];++i)
        cout<<"*";
        cout<<"\n";
        cout<<"70 - 100";
        for(i=0;i<grade[3];++i)
        cout<<"*";
        cout<<"\n";

This is for turbo C++ and not for visual C++ ( Ps i need it for visual C++)

Thanks for the help

First off that's not complete code. You should submit the whole code.

Secondly what doesn't work? What is it doing right? What is it doing wrong?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.