-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path9.cpp
39 lines (33 loc) · 815 Bytes
/
9.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
/*WAP to create a class employee having data members empid, empname, age; use member functions getdata() &displaydata() to read
& display the data. Keep data members as private.*/
#include<iostream>
#include<string>
using namespace std;
class employee
{
private:
int empid;
string empname;
int age;
public:
void getdata()
{
cout<< "Enter Employee ID: ";
cin>> empid;
cout<< "Enter Employee Name: ";
cin>> empname;
cout<< "Enter Employee Age: ";
cin>> age;
}
void displaydata()
{
cout<< "\nEmployee ID: "<< empid << "\nEmployee Name: "<<empname << "\nEmployee Age: "<<age;
}
};
int main()
{
employee one;
one.getdata();
one.displaydata();
return 0;
}