重複の可能性:
getline() のヘルプが必要
getline 関数を cin と組み合わせて使用してキーボードから入力を取得しようとしていますが、私のコードは getline ステートメントをスキップし、代わりに以下の cin 関数に進みます。これが私のコードと何が起こっているかのスクリーンショットです。
void addmovie(ofstream& MovieContentsFile) {
string movieTitle;
int movieQuantity;
cout << " \n Add Movie Selected \n " << endl;
cout << "Please type in the movie title and press enter \n" << endl;
getline(cin,movieTitle, '\n');
cout << "Movie: " << movieTitle << "Please type in the amount of copies we have of this movie \n " << endl;
cin >> movieQuantity;
なぜこれが起こっているのか、そして今後それを回避する方法を教えていただければ幸いです