forked from theakashshukla/C-Plus-Plus
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudentusingclass.cpp
43 lines (39 loc) · 1.01 KB
/
studentusingclass.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
//some student attrirbutes using class
#include <iostream>
using namespace std;
class student
{
private: //private data members
int rollno;
char name[20], branch[10];
float marks;
public: //public member functions
void input();
void Display();
};
void student :: input()
{
cout<<"Enter rollno"<<endl;
cin>>rollno;
cout<<"Enter name"<<endl;
cin>>name;
cout<<"Enter marks"<<endl;
cin>>marks;
cout<<"branch"<<endl;
cin>>branch;
}
void student :: Display()
{
cout<<"Rollno:"<<rollno<<endl;
cout<<"Name:"<<name<<endl;
cout<<"Marks:"<<marks<<endl;
cout<<"branch:"<<branch<<endl;
}
};
int main()
{
student s;
s.input();
s.Display();
return 0;
}