+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROGRAM # 31
FILE NAME : PROGRAM31.CPP
BY : NAVNEET KAUR
ROLL NO. : 23
CLASS : 12 – B
CHAPTER : STRUCTURES ( NESTED STRUCTURES )
TEACHER’S SIGN :
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* AIM : PROGRAM TO SHOW NESTING IN STRUCTURES . IN THIS PROGRAM
DETAILS OF AN EMPLOYEE */
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
struct dob
{
int yr;
int dt;
int mth;
};
struct emp
{
long empno;
char name[20];
dob date;
};
void showdata(emp);
void main( )
{
clrscr( );
emp e1;
cout<<"\n Enter the number:";
cin>>e1.empno;
cout<<"\n Enter name:";
cin.getline(e1.name,20);
cout<<"\n Enter dob;";
cout<<"\n Enter date:";
cin>>e1.date.dt;
cout<<"\n Enter month:";
cin>>e1.date.mth;
cout<<"\n Enter year:";
cin>>e1.date.yr;
showdata(e1);
}
void showdata(emp e2)
{ clrscr( );
cout<<"\n Employee no : "<<e2.empno;
cout<<"\n Employee name : "<<e2.name;
cout<<"\n Date of birth : ";
cout<<e2.date.dt<<" - "<<e2.date.mth<<" - "<<e2.date.yr;
}
OUTPUT
Employee no : 2808
Employee name : ASHISH SINGH
Date of birth : 09 - 03 - 1970