Or you can just add cin.ignore() before getline. ignore() function (as its name says) ignore any previous input so you will be able to enter book name.