#include <iostream.h>
#include <conio.h>
void main()
{
struct date
{
int day ;
int month ;
int year ;
} ;
struct item
{
char *item_name ;
int price ;
struct date manufacture_date ; /* structure within structure
Declaration */
} ;
struct item a ;
clrscr () ;
a.item_name = "Soap" ;
a.price = 10 ;
a.manufacture_date.day = 2; /*structure within structure*/
a.manufacture_date.month = 11 ; /* initialisation */
a.manufacture_date.year = 1999 ;
cout<<"Item Details :\n";
cout<<"\nName : "<<a.item_name;
cout<<"\nPrice : "<<a.price;
cout<<"\nDate : "<<a.manufacture_date.day;
cout<<"/"<<a.manufacture_date.month;
cout<<"/"<<a.manufacture_date.year;
getch () ;
}
0 comments:
Post a Comment