grading exercise program

I am having an issue with this program. I am new to this obviously and am fuzzed as to what to do with my int main ().

An example as to how to lay this out would be a great start for me to understand what to do. I am not asking for a handout just a simple point into the correct direction.

this is what the output should look like:

enter the student id: 111
enter exam1 score: 80
enter exam2 score: 90
*** Output ***
student id - 111
exam1 score - 80
exam2 score - 90
class average - 85
letter grade - B




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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 #include <iostream>
#include <string>
 using namespace std;
 
class StudentRecord {
 private:
 char studentID [5];
 
public:
 double classavg;
 double exam1;
 double exam2;
 char lettergrade;
 int objStudent;

 void input () {
 cout << "Enter the Student ID: ";
 cin >> studentID ;
 cout << "Enter Exam 1 Score: ";
 cin >> exam1 ;
 cout << "Enter Exam 2 score: ";
 cin >> exam2 ;
 cout <<"***Output***"<< endl;
 classavg = (exam1+exam2) / 2;

 }
 public: 
void output () {
 if (classavg<=100 && classavg>89)
 lettergrade='A';
 else if (classavg<=89 && classavg>79)
 lettergrade='B';
 else if (classavg<=79 && classavg>69)
 lettergrade='C';
 else if (classavg<=69 && classavg>59)
 lettergrade='D';
 else if (classavg<=59 && classavg>0)
 lettergrade='F';
 

cout << "Student ID - " << studentID << endl;
 cout << "Exam 1 score - " << exam1 << endl;
 cout << "Exam 2 score - " << exam2 << endl; 
cout << "Class average - " << classavg << endl;
 cout << "Letter grade - " << lettergrade << endl;
 } 
};
int main () 
{
    StudentRecord obj;
    obj.input;
    obj.output;
        
 return 0;
 }
}
Last edited on
you have a character array defined for student id, you can't just do cin>>studentId.
Topic archived. No new replies allowed.