This program takes the name,age, and salary of the employee as input and just displays the entered data.
#include<iostream.h>
class Employee
{
private:
char cname[30];
int iage,isalary;
public:
void getdata( ) //Function to get input from the user
{
cout<<"Enter the Name of the Employee"<<endl;
cin>>cname[30];
cout<<"Enter the Age and salary of the employee"<<endl;
cin>>iage>>isalary;
}
void display( ) //Function to display the entered data
{
cout<<"***************************"<<endl;
cout<<"Name of the Employee : "<<name[30];
cout<<"Age : "<<endl;
cout<<"Salary : "<<endl;
cout<<"***************************"<<endl;
}
}; //End of class
void main( )
{
Employee e1,e2,e3; //Creating objects e1,e2,e3
e1.getdata( ); // Calling getdata function using object e1
e2.getdata( );
e3.getdata( );
e1.display( ); //Calling getdata function using object e1
e2.display( );
e3.display( );
}
No comments:
Post a Comment