Pages

100 Contemporary Living Room Designs

Thursday, August 2, 2012

C++ PROGRAM TO ACCEPT AND PRINT THE DETAILS OF AN EMPLOYEE



#include<iostream.h>
#include<conio.h>
class employee
{
 int emp_id;
 char name[25],post[30];
 public:
 void read();
 void print();
};
void employee::read()
{
 cout<<"Enter employee id\n";
 cin>>emp_id;
 cout<<"Enter employee name\n";
 cin>>name;
 cout<<"Enter employee post\n";
 cin>>post;
}
void employee::print()
{
 cout<<"\n\nID\tNAME\tPOST\n";
 cout<<emp_id<<"\t"<<name<<"\t"<<post<<endl;
}
void main()
{
 clrscr();
 employee e; // object creation
 e.read(); //read function call
 e.print(); //print function call
 getch();
}


output 


No comments:

Post a Comment