Progrm-12
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class Student
{
private:
int admin_no;
char name[30];
int cla;
int roll_no;
public:
Student()
{
admin_no=0;
cla=1;
strcpy(name,"XYZ");
roll_no=1;
}
void getdata()
{
cout<<"Enter name:";
gets(name);
cout<<"Enter admission number:";
cin>>admin_no;
cout<<"Enter class:";
cin>>cla;
cout<<"Enter roll number:";
cin>>roll_no;
}
void showdata()
{
cout<<endl<<"Name:"<<puts(name);
cout<<endl<<"Admission number:"<<admin_no;
cout<<endl<<"Class:"<<cla;
cout<<endl<<"Roll Number:"<<roll_no;
}
};
void main()
{
clrscr();
Student S[10];
int i=0;
for(i=0;i<10;i++)
{
cout<<"Enter data of Student No."<<i+1<<"->>>>>";
cout<<endl;
S[i].getdata();
}
for(i=0;i<10;i++)
{
cout<<endl<<"Information of Student No."<<i+1<<"->>>>";
cout<<endl;
S[i].showdata();
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class Student
{
private:
int admin_no;
char name[30];
int cla;
int roll_no;
public:
Student()
{
admin_no=0;
cla=1;
strcpy(name,"XYZ");
roll_no=1;
}
void getdata()
{
cout<<"Enter name:";
gets(name);
cout<<"Enter admission number:";
cin>>admin_no;
cout<<"Enter class:";
cin>>cla;
cout<<"Enter roll number:";
cin>>roll_no;
}
void showdata()
{
cout<<endl<<"Name:"<<puts(name);
cout<<endl<<"Admission number:"<<admin_no;
cout<<endl<<"Class:"<<cla;
cout<<endl<<"Roll Number:"<<roll_no;
}
};
void main()
{
clrscr();
Student S[10];
int i=0;
for(i=0;i<10;i++)
{
cout<<"Enter data of Student No."<<i+1<<"->>>>>";
cout<<endl;
S[i].getdata();
}
for(i=0;i<10;i++)
{
cout<<endl<<"Information of Student No."<<i+1<<"->>>>";
cout<<endl;
S[i].showdata();
}
getch();
}