//Engr Ahmad Furqan Attari
//Chapter 6, Problem 4
#include <iostream>
#include <conio.h>
using namespace std;
class employee
{
private:
int e_num;
float salary;
public:
void enter_data(void)
{
cout<<"Enter employee number: ";
cin>>e_num;
cout<<"Enter employee's salary: ";
cin>>salary;
}
void display(void)
{
cout<<"Employee number: "<<e_num<<endl;
cout<<"Employee salary: "<<salary;
}
};
void main(void)
{
employee emp1,emp2,emp3;
cout<<"Enter data for employee 1 "<<endl;
emp1.enter_data();
cout<<"Enter data for employee 2 "<<endl;
emp2.enter_data();
cout<<"Enter data for employee 3 "<<endl;
emp3.enter_data();
cout<<"The entered data is "<<endl;
emp1.display();
cout<<endl;
emp2.display();
cout<<endl;
emp3.display();
getch();
}
//Chapter 6, Problem 4
#include <iostream>
#include <conio.h>
using namespace std;
class employee
{
private:
int e_num;
float salary;
public:
void enter_data(void)
{
cout<<"Enter employee number: ";
cin>>e_num;
cout<<"Enter employee's salary: ";
cin>>salary;
}
void display(void)
{
cout<<"Employee number: "<<e_num<<endl;
cout<<"Employee salary: "<<salary;
}
};
void main(void)
{
employee emp1,emp2,emp3;
cout<<"Enter data for employee 1 "<<endl;
emp1.enter_data();
cout<<"Enter data for employee 2 "<<endl;
emp2.enter_data();
cout<<"Enter data for employee 3 "<<endl;
emp3.enter_data();
cout<<"The entered data is "<<endl;
emp1.display();
cout<<endl;
emp2.display();
cout<<endl;
emp3.display();
getch();
}
No comments:
Post a Comment