#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class employee
{
char *name;
float s;
int emp_no;
int age,expr;
char *p;
public:
void read();
void display();
};
void employee::read()
{
name=p;
cout<<"\nenter the name of employee ";
gets(name);
cout<<"\nenter the salary ";
cin>>s;
cout<<"\nenter the employee ID ";
cin>>emp_no;
cout<<"\nenter the age ";
cin>>age;
cout<<"\nenter the experience in years ";
cin>>expr;
}
void employee::display()
{
cout<<"\nthe employee name "<<name;
cout<<"\nthe employee salary "<<s;
cout<<"\nthe employee ID "<<emp_no;
cout<<"\nthe employee age "<<age;
cout<<"\nthe employee experience "<<expr;
}
void main()
{
employee e1,e2;
clrscr();
cout<<"\nenter the record of employee 1 ";
e1.read();
cout<<"\nenter the record of employee 2 ";
e2.read();
cout<<"\nthe record of employee 1 ";
e1.display();
cout<<"\n\nthe record of employee 2 ";
e2.display();
getch();
}
#include<conio.h>
#include<stdio.h>
class employee
{
char *name;
float s;
int emp_no;
int age,expr;
char *p;
public:
void read();
void display();
};
void employee::read()
{
name=p;
cout<<"\nenter the name of employee ";
gets(name);
cout<<"\nenter the salary ";
cin>>s;
cout<<"\nenter the employee ID ";
cin>>emp_no;
cout<<"\nenter the age ";
cin>>age;
cout<<"\nenter the experience in years ";
cin>>expr;
}
void employee::display()
{
cout<<"\nthe employee name "<<name;
cout<<"\nthe employee salary "<<s;
cout<<"\nthe employee ID "<<emp_no;
cout<<"\nthe employee age "<<age;
cout<<"\nthe employee experience "<<expr;
}
void main()
{
employee e1,e2;
clrscr();
cout<<"\nenter the record of employee 1 ";
e1.read();
cout<<"\nenter the record of employee 2 ";
e2.read();
cout<<"\nthe record of employee 1 ";
e1.display();
cout<<"\n\nthe record of employee 2 ";
e2.display();
getch();
}
No comments:
Post a Comment