//Program to enter and display the contents of a class
#include<iostream.h>
#include<conio.h>
class emp
{
public:
int empid;
char name[15];
class data
{
public:
int day,month,year;
}doj;
}e;
void main()
{
clrscr();
cout<<"enter employee id"<<endl;
cin>>e.empid;
cout<<"enter name"<<endl;
cin>>e.name;
cout<<"enter date of joining"<<endl;
cin>>e.doj.day;
cout<<"enter month of joining"<<endl;
cin>>e.doj.month;
cout<<"enter year of joining"<<endl;
cin>>e.doj.year;
cout<<"emp.id:"<<e.empid<<endl;
cout<<"emp name:"<<e.name<<endl;
cout<<"date of joing:"<<e.doj.day<<"-"<<e.doj.month<<"-"<<e.doj.year<<endl;
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.