0% found this document useful (0 votes)
36 views

PROGRAM1

This C++ program defines nested structures to store employee data including number, name, and date of birth. It takes in employee details as input, stores it in the nested structures, and displays the stored details as output.

Uploaded by

bkshukla6669
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

PROGRAM1

This C++ program defines nested structures to store employee data including number, name, and date of birth. It takes in employee details as input, stores it in the nested structures, and displays the stored details as output.

Uploaded by

bkshukla6669
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

You might also like