Keeps skipping getline(cin, bookTitle);

In case it matters, here is the code for the entire program...

#include <iostream>#include <fstream>using namespace std;fstream bookSave; //for writing and reading books.txtint bookNum; // To assign a number to each bookstring bookTitle, bookAuthor, bookGenre; //Book datavoid saveData(){    bookSave.open("books.txt");    bookSave <<bookNum<<"\t\t"<<bookTitle<<"\t\t"<<bookAuthor<<"\t\t"<<bookGenre<<endl; // writes strings to books.txt    bookNum++; //increments the value of bookNum everytime it saves a book    bookSave.close();}void bookAdd() //User adds values to the book data{    cout<<"Please enter the Title of the book: ";    getline(cin, bookTitle);     cout<<endl;    cout<<"Please enter the Author of the book: ";    getline(cin, bookAuthor);    cout<<endl;    cout<<"Please enter the Genre of the book: ";    cin>>bookGenre;    cout<<endl;    saveData();    int main();}void bookView()//User views books{    string content;    bookSave.open("books.txt");    while(getline(bookSave, content)){        cout<<content;    }}void mainMenu() //Gets user choice to add books or view books{    int menSelect;//For getting user's menu selection    start:    cout<<"Welcome to the Book Database!"<<endl;    cout<<"Please select an option."<<endl;    cout<<"1. Add A Book || 2. View Books"<<endl;    cin>>menSelect;    switch(menSelect){case 1:    bookAdd();break;case 2:    bookView();break;default:    cout<<"ERROR INVALID INPUT. PLEASE TRY AGAIN"<<endl;    goto start;    };}int main(){    mainMenu();    return 0;}
/r/cpp_questions Thread