-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.cpp
More file actions
49 lines (46 loc) · 761 Bytes
/
class.cpp
File metadata and controls
49 lines (46 loc) · 761 Bytes
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
#include<iostream>
using namespace std;
class student{
int roll_no,marks,grade;
char name[100];
public: void get()
{
cout << "Enter the roll_no, name and the marks of the student";
cin >>roll_no>>name>>marks;
grades();
}
void show()
{
cout<< "Roll Number ="<< roll_no;
cout<< "name = "<< name;
cout<< "marks = "<< marks;
}
void grades()
{
if(marks>80)
grade = 'A';
else
if(marks>60)
grade = 'B';
else
grade = 'C';
}
};
main()
{
int menu=1;
student data;
while(menu!=0)
{
cout << "Press the number to perform the task\n";
cout << "Option\tNumber\nEnter data\t1\nShowdata\t2\n";
cin >> menu;
if(menu==1)
data.get();
else
if(menu==2)
data.show();
else
cout << "Bye";
}
}