Gotta add more to this, help!

Heres my code so far. I did everything that I was sure I knew what I was doing up to this point but here are the things I dont know how to do:

- When the user enters the 3 test scores, I gotta make it so it averages it and then displays it in the output, not sure how to do this.

- If the average is 73 or higher then it displays "Successful" and if they don't it displays "Unsuccessful". Not sure how to do this either.
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
#include <iostream>
#include <stdio.h>
#include <conio.h>

using namespace std;
class student
{
      private :
             int sno;
             char name[20];
             int g1,g2,g3;
      public :
             void Getdata()
             {
				 cout << "Enter Student ID:  "; cin >> sno;
				 cout << "Enter Student NAME:  "; cin >> name;
				 cout << "Enter Student TEST SCORES (3):  ";
                 cin >> g1 >> g2 >> g3;
             }
             void Putdata()
             {
                   cout  << "Student ID :" << sno;
                   cout << "Student NAME      :" << name;
				   cout << "Student TEST SCORES (3)     :" << g1 << "  " <<g2<<"  "<<g3;
            }
};

int main()
{
      student s;
      s.Getdata();
      s.Putdata();
      return 0;
}
create a function that calculates the average. you need 3 input parameters and return float or double since you need to divide to get the average.

if you can't figure out how to do it, ask again
Put this on line 25
1
2
3
4
5
6
                 cout << "Average = " << (g1+g2+g3)/3 << endl;
                 if ((((g1+g2+g3)/3) >= 73))
                 {cout << "Successful" << endl;}
                 else
                 {cout << "Unsuccessful" << endl;}
                 }
Topic archived. No new replies allowed.