#include<iostream.h>
#include<conio.h>
class A
{
int a[10];
char name[10];
public:
void read();
void display();
};
void A::read()
{
cout<<"enter rno name";
for(int i=0;i<3;i++)
{
cin>>a[i];
cin>>name;
//cin>>a[i];
}
}
void A::display()
{
//cout<<count;
for(int i=0;i<3;i++)
cout<<a[i]<<name;
}
//int A::count;
main()
{
clrscr();
A x;
x.read();
x.display();
getch();
}
here i need to read 3 rollnumbers and 3 names
and print the same.
but am getting only the last name for all rollnumbers
how could i code to get individual name for every rno.