WAP TO READ VALUES IN NESTED STRUCTURE ( EG. STUDENT NAME,STUDENT ROLL NO.,STUDENT DOB )

 

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct date
{
     int day;
     int month;
     int year;
};
struct student
{
    char name[40];
    int rollno;
};
void main()
{
      struct student s1;
      clrscr();
      cout<<”Enter the student name:”
      gets(s1.name);
      cout<<”Enter the student roll no.:”;
      cin>>s1.rollno;
      cout<<”Enter the student date of birth:”;
      cin>>s1.dob.day>>s1.dob.month>>s1.dob.year;
      cout<<”\n”;
      cout<<”Student name is:”<<s1.name;
      cout<<”Student roll no. is:”<<s1.rollno;
      cout<<”Student date of birthis:”<<s1.dob.day<<”/”
              <<s1.dob.month<<”/”<<s1.dob.year;
      getch();

}  

Comments

Popular Posts