Alrighty, so what I am trying to do is print off a vector of 20 last names onto the command line. (This is not all I'm trying to do in this particular case, but for clarification I am trying to print out 20 students information on the command line, the information being their ID number, last name, and age. I'll post the vector first and then the function that is calling for all the information to be gathered below (age is missing because I haven't got to it yet) But my question is, am I using this vector of strings correctly? When I compile I am told that
"error: could not convert '{"Simmons", "Jones", "James", "Little", "Russell", "Haynes", "Marcotte", "Kemper", "Vandergore", "Hume", "Stephens", "Jensen", "Biersack", "Sykes", "Joseph", "Dunn", "Hai", "Meteos", "Aphromoo", "Faker"}' from '' to 'std::vector >'|"
The type of answer I'm hoping to find is why I am getting this error, how I can fix it, and how I can avoid having this problem next time. Thanks everyone!
vector<int> studentNumber (20);
vector<string> lastName = {"Simmons", "Jones", "James", "Little", "Russell", "Haynes", "Marcotte", "Kemper", "Vandergore", "Hume", "Stephens", "Jensen", "Biersack", "Sykes", "Joseph", "Dunn", "Hai", "Meteos", "Aphromoo", "Faker"};
void getAllStudentInfo() {
for (vector<int>::size_type i = 0; i <= 20; i++) {
cout << "Student's ID number is: " << 400 + i << endl;
}
for (int i = 0; i < lastName.length(); i++) {
cout << lastName[i] <<endl;
}
return;
}