-
Notifications
You must be signed in to change notification settings - Fork 0
/
Class.cpp
47 lines (47 loc) · 911 Bytes
/
Class.cpp
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
#include <iostream>
using namespace std;
class student
{
private:
int ad_num;
float eng_m, math_m, science_m, tot_marks;
char s_name[10];
float ctotal()
{
float tot_marks= eng_m + math_m + science_m;
return tot_marks;
}
public:
student()
{
cout << "ENTER ADMISSION NUMBER: ";
cin >> ad_num;
cout << "ENTER STUDENT NAME: ";
cin >> s_name;
cout << "ENTER ENGINEERING MATH: ";
cin >> eng_m;
cout << "ENTER MATH MARKS: ";
cin >> math_m;
cout << "ENTER SCIENCE MARKS: ";
cin >> science_m;
}
void show()
{
cout << "ADMISSION NUMBER: "<<ad_num<<endl;
cout << "STUDENT NAME: " <<s_name<< endl;
cout << "ENGINEERING MATH: "<<eng_m<<endl;
cout << "MATH MARKS: "<<math_m<<endl;
cout << "SCIENCE MARKS: "<<science_m<<endl;
cout <<"TOTAL MARKS: " <<ctotal();
}
};
int main()
{
//student stu;
//stu.show();
student* ptr;
student stu;
ptr = &stu;
ptr->show();
return 0;
}