I NEED HELP.

I have been asked to write a simple program to determine the grade of a student given the condition below;

0 - 49 =F
50 - 59 =D
60 - 69 =C
70 - 79 =B
80 - 100 =A

Please i need help on how to initiate, where and when to loop. The way the tutor teaches us makes it difficult to understand the c++ language. Please help me out.
Something like this I believe.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>

using namespace std;

int main()
{
    int percent;

    cout << "Enter percentage" << endl;
    cin >> percent;

    cout << "\n";

    if((percent > 0) && (percent <= 49))
    {
        cout << "This student got an F" << endl;
    }
    if((percent > 49) && (percent <= 59))
    {
        cout << "This student got a D" << endl;
    }
    if((percent > 59) && (percent <= 69))
    {
        cout << "This student got a C" << endl;
    }
    if((percent > 69) && (percent <= 79))
    {
        cout << "This student got a B" << endl;
    }
    if((percent > 79) && (percent <= 100))
    {
        cout << "This student got an A" << endl;
    }
    else{cout << "Not a valid number" << endl;}
}
Last edited on
I wish my school used that grading scale.
How do i write a program to calculate the area of the following shapes; circle, rectangle, square, triangle and trapezium using a switch case? Switch case concept is new to me. Please help me out.
Last edited on
Im not good at math or geometry so sorry i cant help, unless you give alot more info and maybe i could.
Topic archived. No new replies allowed.