ユーザーに double と long の文字列を入力してもらいたいのですが、最初は文字列が無視されて空のままになり、直接 double を入力するように求められます。
ここに私のコードがあります:
#include <iostream>
#include <string>
using namespace std;
int main () {
    string name;
    double price;
    long serial;
    cout << "Enter the dvd's name: "; getline(cin, name);
    cout << "Enter the dvd's price (in $): "; cin >> price;
    cout << "Enter the dvd's serial number: "; cin >> serial;
    cout << endl;
    cout << "Enter the dvd's name: "; getline(cin, name);
    cout << "Enter the dvd's price (in $): "; cin >> price;
    cout << "Enter the dvd's serial number: "; cin >> serial;
    return 0;
}

最初にわかるように、文字列を入力すると、2 回目に直接 double に送信されます。欠落している文字列を無視して、double と long を入力しても、name は空の文字列として出力されます。
コードの何が問題になっていますか?