void bookType::setAuthor(int authorCount)
cout << "Enter the name of the author and then press enter." << endl;
for(int i = 0; i < authorCount; i++)
author[i] = name;
This is the code that I have so far. This method receives the number of authors that a book has as a parameter, asks the user for the name of the authors, keeps track of the number of authors for the class bookType, and then assigns the names to the array author that is a private attribute of the class bookType.
Let's say that the author count is two. For some reason, the first element in the array author is skipped and the getline method is skipped also. It allows me to enter a name on the second iteration of the loop though, and stores the name into the element 1 of author (author.) Does anyone know what I am doing wrong, or why the first iteration of getline and element 0 is skipped?
I've got everything commented out in my code except for the necessary statements to carry out this method, and the problem still occurs. This is the only input that I am getting from the user at the moment. Maybe I'm just not understanding your solution.