Tuesday 3 September 2013

Question2 Structure Student Details

#include<iostream.h>
#include<conio.h>
struct student
{
    int no;
    char name[20],course[20];
}stud1[5];
void main()
{
    int i;
    clrscr();
    cout<<"\n Enter The Details : \n";
    for(i=0;i<2;i++)
    {
        cout<<"\n Enter The Student Number: ";
        cin>>stud1[i].no;
        cout<<"\n Enter The Student Name: ";
        cin>>stud1[i].name;
        cout<<"\n Enter The Student Course: ";
        cin>>stud1[i].course;
    }
    cout<<"\n Student Details \n";
    for(i=0;i<2;i++)
    {
        cout<<"\n"<<stud1[i].no<<"\t";
        cout<<stud1[i].name<<"\t";
        cout<<stud1[i].course<<"\n";
    }
getch();
}

No comments:

Post a Comment