这一行的get()有什么用?为什么不能删去?



void newit_1()
{
    typedef struct {
        string name;
        double diameter;
        double weight;
    }Pizza;
    Pizza *pizza = new Pizza ;//指针

    cout << "How many big do you want?"<< endl;
    (cin >> pizza[0].diameter).get() ;
    cout << "Please enter the name of the company!"<<endl;
    getline(cin , pizza[0].name);
    cout << "weight?" << endl;
    cin >> pizza[0].weight;

    cout << "The name of the Pizza Company: " <<  pizza[0].name << endl;
    cout << "The diameter of the Pizza Company: " << pizza[0].diameter<< endl;
    cout << "The weight of the Pizza Company: " << pizza[0].weight << endl;

    delete pizza;

}
    (cin >> pizza[0].diameter).get() ;

这一行的get()有什么用,最好具体一点。为什么不能删去?

get()应该是用来接收掉输入一个浮点数以后的换行符的。否则下面的getline可能接收这个换行符,导致没有正确接收输入的名称信息