/* Write a program to input the register number, name and class of all the students in a class into a structure and output the data in a tabular manner with proper heading */
#include<iostream.h>
#include<conio.h>
void main()
{
struct student
{
int regno;
char name[25];
char section[10];
};
student s[50];
int i,n;
clrscr();
cout<<"How many students? ";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter the register number of the student "<<i+1<<":";
cin>>s[i].regno;
cout<<"Enter the name of the student "<<i+1<<":";
cin>>s[i].name;
cout<<"Enter the section of the student "<<i+1<<":";
cin>>s[i].section;
}
cout<<"REGNO\tNAME\tSECTION\n";
for(i=0;i<n;i++)
cout<<s[i].regno<<"\t"<<s[i].name<<"\t"<<s[i].section<<endl;
getch();
}

No comments: