Earn without any Investment!

Saturday, November 13, 2010

Employee Details using class & member function

#include<iostream.h>
#include<conio.h>
class employee
{
int emp_no;
char emp_name[20];
float emp_sal;
public:
void get();
void dis();
};
void employee::get()
{
cout<<"Enter employee number:";
cin>>emp_no;
cout<<"Enter employee name:";
cin>>emp_name;
cout<<"Enter salary:";
cin>>emp_sal;
}
void employee::dis()
{
cout<<"\n\tEmployee Details";
cout<<"\n\t   Number : "<<emp_no;
cout<<"\n\t    Name  : "<<emp_name;
cout<<"\n\t   Salary : "<<emp_sal;
}
void main()
{
clrscr();
employee e;
e.get();
e.dis();
getch();
}

7 comments: