WAP TO READ VALUES IN ARRAY OF STRUCTURE
WAP TO READ VALUES IN ARRAY OF STRUCTURE
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct
student
{
char name[25];
int rollno;
};
Void main()
{
struct student s[5];
int i;
clrscr();
for(i=0;i<5;i++)
{
cout<<”Enter
”<<i+1<<” student name:”;
gets(s[i].name);
cout<<”Enter
”<<i+1<<” student roll no.:”;
cin>>s[i].rollno;
}
cout<<”\n”;
for(i=0;i<5;i++)
{
cout<<i+1<<”Student name
is:”<<s[i].name;
cout<<i+1<<”Student
roll no. is:”<<s[i].rollno;
}
getch();
}
Comments
Post a Comment