by Dinesh Thakur Category: Array Pointer and Union

 

#include <iostream.h>

#include <conio.h>
const int size=20;
   struct sl
{
  char name[size];
  int entryno;
  float fees;
          struct dl
       {
             int day;
             int month;
             int year;
        }date;
};
  void main(void)
{
   sl s[2];
   int I,J;
   clrscr();
  for(I=0;I<2;I++)
     {
            cout<<"Enter Name : " ;
            cin>>s[I].name;
            cout<<"Enter Entry_NO : ";
            cin>>s[I].entryno;
            cout<<"Enter Fees : ";
            cin>>s[I].fees;
            cout<<"Enter day : ";
            cin>>s [I].date.day;
            cout<<"Enter month : ";
            cin>>s[I].date.month;
            cout<<"Enter year : ";
            cin>>s[I].date.year;
             cout<<'\n';
     }
          for(I=0;I<2;I++)
       {
            cout <<"Name : ";
            cout<<s[I].name<<'\n' ;
            cout <<"Entry_NO : ";
            cout<<s[I].entryno<<"\n" ;
            cout<< "Day month Year : ";
            cout<<"\n" ;
            cout<<s[I].date.day<<" "<<s[I].date.month<<" "<<
            s[I].date.year<<"\n" ;
            cout<<"Fees : ";
            cout<<s[I].fees;
            cout<<"\n" ;
      }
           getch();
}

Array of Structures



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles