class student
{
private:
int roll_no;
char name[30];
public:
void setdata(int roll_no_in,char*name_in)
{
roll_no=roll_no_in;
strcpy(name,name_in);
}
void outdata()
{
cout<<"rollno:"<<
cout<<"name:"<<
}
};
void main()
{
clrscr();
int i,roll_no,count;
char response,name[20];
student s[10];
count=0;
for(i=0;i<10;i++)
{
cout<<"intializing student object y/n";
cin>>response;
if(response=='y')
{
cout<<"enter the roll no.ofstudent:";
cin>>roll_no;
cout<<"enter the name of student:";
cin>>name;
s[i].setdata(roll_no,name);
count++;
}
else
break;
}
cout<<"student details"<
for(i=0;i
s[i].outdata();
getch();
}
{
private:
int roll_no;
char name[30];
public:
void setdata(int roll_no_in,char*name_in)
{
roll_no=roll_no_in;
strcpy(name,name_in);
}
void outdata()
{
cout<<"rollno:"<<
cout<<"name:"<<
}
};
void main()
{
clrscr();
int i,roll_no,count;
char response,name[20];
student s[10];
count=0;
for(i=0;i<10;i++)
{
cout<<"intializing student object y/n";
cin>>response;
if(response=='y')
{
cout<<"enter the roll no.ofstudent:";
cin>>roll_no;
cout<<"enter the name of student:";
cin>>name;
s[i].setdata(roll_no,name);
count++;
}
else
break;
}
cout<<"student details"<
for(i=0;i
No comments:
Post a Comment