google search

Popular Posts


Welcome to BCA Notes

>>>>>>>>>>>>>>>>

Visitors

Search This Blog

Blogger templates

Visitor Map


Wednesday, 26 March 2014

Structure with array

#include<iostream.h>
struct stud
{
char name[20],mo[10],cou[10],age[3];

}d[10];
main()
{
int a;
for(a=1;a<=3;a++)
{
cout<<"Enter your name:-";
cin.getline(d[a].name,20);
cout<<"Enter age:-";
cin.getline(d[a].age,3);
cout<<"Enter your mobile no:-";
cin.getline(d[a].mo,10);
cout<<"Enter your course:-";
cin.getline(d[a].cou,10);

}
cout<<"-----------------------------"<<endl;
cout<<"-----------------------------"<<endl;
for(a=1;a<=3;a++)
{
cout<<"Info of No."<<a<<"Student"<<endl;
cout<<"Name:"<<d[a].name<<endl;
cout<<"Age:"<<d[a].age<<endl;
cout<<"Mobile No.:"<<d[a].mo<<endl;
cout<<"Course:"<<d[a].cou<<endl;
}
}

0 comments:

Post a Comment