//WAP to implement
structure within structure
#include<iostream.h>
#include<conio.h>
#include<iostream.h>
#include<conio.h>
//Declaration
of Structure
struct
emp
{
int empid;
char name[15];
struct date
{
int day,month,year;
}doj;
}e;
void main()
{
struct emp e;
clrscr();
{
int empid;
char name[15];
struct date
{
int day,month,year;
}doj;
}e;
void main()
{
struct emp e;
clrscr();
//Entry
of data
cout<<"Enter employee id\n";
cin>>e.empid;
cout<<"Enter name of the employee\n";
cin>>e.name;
cout<<"Enter date of joining of employee\n";
cin>>e.doj.day;
cout<<"Enter month of joining\n";
cin>>e.doj.month;
cout<<"Enter year of joining\n";
cin>>e.doj.year;
cout<<"Enter employee id\n";
cin>>e.empid;
cout<<"Enter name of the employee\n";
cin>>e.name;
cout<<"Enter date of joining of employee\n";
cin>>e.doj.day;
cout<<"Enter month of joining\n";
cin>>e.doj.month;
cout<<"Enter year of joining\n";
cin>>e.doj.year;
//Display
of data
cout<<"\n************************\n";
cout<<"Emp ID:"<<e.empid;
cout<<"\nEmp Name:"<<e.name;
cout<<"\nDate of joining:"<<e.doj.day<<"-"<<e.doj.month<<"-"<<e.doj.year%100;
cout<<"\n************************\n";
getch();
}
cout<<"\n************************\n";
cout<<"Emp ID:"<<e.empid;
cout<<"\nEmp Name:"<<e.name;
cout<<"\nDate of joining:"<<e.doj.day<<"-"<<e.doj.month<<"-"<<e.doj.year%100;
cout<<"\n************************\n";
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.