Why the array doesnt let me write for the first student?

int sizen;

cout<<"Enter the number of students ";

string names[sizen];
for (int  i=0; i < sizen ; i++)
cout<<"enter #"<<(i+1)<<"student's name ': ";

Don’t be so quick to blame the array.
If you run it, watch what happens, what’s different from what you expect?
The getline call doesn’t block (wait) until there’s input.
This is because there’s already a newline waiting in the stream, cin >> sizen did not consume that newline.
If you google cin and getline you’ll get plenty of results about the same problem (and suggestions on how to get around it)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.