|
Answer» #include<iostrean.h> #include<conio.h> #include<stdio.h> class Employee { int code; char name [20], dept [20]; float salary; public: void Enter(); void Display(); }; void Employee: : Enter() { cout<<"Enter Employee Code:"<<end1; cin>>code; cout<<"Enter Employee Name:"<<end1; gets (name); cout<<"Enter Employee Department: "<<end1; gets (dept); cout<<"Enter Employee Salary:" <<end1; cin>>salary; } void Employee :: Display ( ) { cout<<"Employee Code:"<<code<<end1; cout<<"Employee Name:"; puts (name); cout<<"Employee Department:"; puts (dept); cout<<"Employee Salary:"<<salary; } void main() { clrscr(); Employee E; E.Enter(); E.Display(); getch(); } आउटपुट Enter Employee Code: 2550 Enter Employee Name: Sonam Sharma Enter Employee Department: Coordinator Enter Employee Salary: 35000 Employee Code:2550 Employee Name:Sonam Sharma Employee Department:Coordinator Employee Salary:35000
|