Hi,
Please I created class called students which suppose to store students names of any sizes in an arrey but when I call the display function it does not show the names.
Please help me with the code.
#include <iostream>
#include <sstream>
using namespace std;
const int SIZE=5;
class students{
public:
string names[SIZE];
students(){
}
void getNames(){
for(int i=0;i<SIZE;i++){
cout<<"Enter first name and last name: ";
getline(cin,names[i]);
}
}
string showNames(){
for(int i=0;i<SIZE;i++){
return names[i];
}
}
};
int main(){
students s;
cout<<"********** STUDENTS NAMES ***********"<<endl;
s.getNames();
cout<<endl;
cout<<"**********AVAILABLE STUDENTS LIST ***********"<<endl;
cout<<s.showNames()<<endl;
return 0;
}