C++ program to get the student details using Structure

#include<iostream.h>
#include<conio.h>
struct scan
{
char z[50];
int x,y,i;
};
void main()
{
clrscr();
scan s1;
cout<<"Enter name of student :- ";
cin>>s1.z;
cout<<"Enter age:- ";
cin>>s1.x;
cout<<"Enter roll No.:- ";
cin>>s1.y;

cout<<"Name of student:- "<<s1.z<<endl;
cout<<"Age of student:- "<<s1.x<<endl;
cout<<"Roll no. of student:- "<<s1.y<<endl;
getch();
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *