Untitled
unknown
plain_text
a year ago
890 B
57
Indexable
#include<iostream>
using namespace std;
class employee {
int id;
char name[25];
int age;
long salary;
public:
void GetData() {
cout << "\n\tEnter Employee ID: ";
cin >> this->id;
cout << "\n\tEnter employee name: ";
cin >> this->name;
cout << "\n\tEnter employee age: ";
cin >> this->age;
cout << "\n\tEnter employee salary: ";
cin >> this->salary;
}
void PutData() {
cout << "\n\tEmployee ID: " << this->id;
cout << "\n\tEmployee Name: " << this->name;
cout << "\n\tEmployee age: " << this->age;
cout << "\n\tEmployee salary: " << this->salary;
}
};
int main() {
employee e;
cout << "\n\tEnter details of employee: ";
e.GetData();
cout << "\nDetails of employee:";
e.PutData();
return 0;
}Editor is loading...
Leave a Comment