programme to output students grade

Write a Program to output the following:
Name of Student
Course
Grade (Based on the marks entered)
marks grades
80-100 A
75-79 B+
60-69 B
55-59 C+
50-54 C
45-49 D
0-44 F

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
  #include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(){


char grade ='A';
switch (grade)
{
case 'A':   cout << "The grade point is 4.0.";   break;
case 'B+':  cout << "The grade point is 3.5.";   break;
case 'B':   cout << "The grade point is 3.0.";   break;
case 'C+':  cout << "The grade point is 2.5.";   break;
case 'C-':  cout << "The grade point is 2.0.";   break;
case 'D':   cout << "The grade point is 1.0.";   break;
case 'F':   cout << "The grade point is 0.0.";   break;
default:    cout << "The grade is invalid.";

    }

}
Hello Majosh,

The switch is OK, but where does "grade" come from?

Where is your input?

How are you storing the information that you input?

I would suggest using a struct to hold the information and an array to store the structs in. A vector would be better.

Although the switch is nice it has nothing to do with what yo need to output..

Right now "cmath" is not needed or used in the program and even with a proper program "cmath" should not be needed.

If you are not sure what to do just say so, but posting what you have really does not say much except that you have missed the mark.

Hope that helps,

Andy
Hello Majosh,

Is there any instructions beyond what you have said so far?

Like how many marks or test scores there will be?

Are these marks fixed in number or is there a variable number per each student.

Not much to go on at the moment.

Andy
Thanks very much
am trying your suggestions
Hello Majosh,

If it any help the program I came up with produced this output:


        Name: Handy Andy
 Course Name: CS101

      85   A
      77   B+
      65   B
      57   C+
      52   C
      47   D
      30   F


 Press Enter to continue:


This could be changed a bit to add headings.

Andy
You had a thread http://www.cplusplus.com/forum/beginner/245567/
It ends quite unexpectedly.

Now you have a second thread, on same problem?
Topic archived. No new replies allowed.