C++ 如何更改程序以在使用fstream时输入带空格的数据 void主板::添加() { 字符x; int X; fstream InFileMB(“Motherboard_List.txt”,ios::in | ios::out | ios::app); 如果

C++ 如何更改程序以在使用fstream时输入带空格的数据 void主板::添加() { 字符x; int X; fstream InFileMB(“Motherboard_List.txt”,ios::in | ios::out | ios::app); 如果,c++,C++,如何更改程序以在使用fstream时输入带空格的数据 void主板::添加() { 字符x; int X; fstream InFileMB(“Motherboard_List.txt”,ios::in | ios::out | ios::app); 如果(!emb) { cerr制造商名称; cout>MB_芯片; cout>MB_名称; cout MB_特性1; cout MB_特征2; cout MB_特征3; cout MB_价格; 系统(“cls”); cout的语法是什么?比如std

如何更改程序以在使用fstream时输入带空格的数据
void主板::添加()
{
字符x;
int X;
fstream InFileMB(“Motherboard_List.txt”,ios::in | ios::out | ios::app);
如果(!emb)
{
cerr制造商名称;
cout>MB_芯片;
cout>MB_名称;
cout MB_特性1;
cout MB_特征2;
cout MB_特征3;
cout MB_价格;
系统(“cls”);

cout的语法是什么?比如std::getline(MB_芯片)这是我应该写的吗?如果是这样,我还需要对那些cout语句进行更改吗?你不需要更改输出。上面的注释是指向引用的链接,它将显示必要的语法。它似乎对我不起作用。
void Motherboards::add()
{
char x;
int X;
fstream InFileMB("Motherboard_List.txt", ios::in | ios::out | ios::app);
if (!InFileMB)
{
    cerr << "Error: Opening File Failed !!";
}
else
{
MotherBoardEntry:
    system("cls");
    cout << " Enter the name of the Manufacturer :\n";
    string MB__Name_Manufacturer;
    cin >> MB__Name_Manufacturer;

    cout << " Enter Chipset Type :\n";
    string MB_Chip;
    cin >> MB_Chip;

    cout << "Enter Name of the board exactly as it`s written on the box :\n";
    string MB_Name;
    cin >> MB_Name;

    cout << "Enter 3 features of this board :\n";
    cout << "1.) ";
    string MB_Feature1;
    cin >> MB_Feature1;
    cout << endl;
    cout << "2.) ";
    string MB_Feature2;
    cin >> MB_Feature2;
    cout << endl;
    cout << "3.) ";
    string MB_Feature3;
    cin >> MB_Feature3;
    cout << endl;

    cout << "Enter Price :\n";
    string MB_Price;
    cin >> MB_Price;

    system("cls");
    cout << "Please check the details before conformation :\n";
    cout << "Motherboard :\n";
    cout << MB__Name_Manufacturer << endl;
    cout << MB_Chip << endl;
    cout << MB_Name << endl;
    cout << "Features :\n";
    cout << "1.) " << MB_Feature1 << endl;
    cout << "2.) " << MB_Feature2 << endl;
    cout << "3.) " << MB_Feature3 << endl;
    cout << "Price :\n";
    cout << MB_Price;
    cout << "\n\n Do You Want To Add The Following Motherboard To Your Stock List ? (y/n)";
    cin >> x;
    system("cls");

    switch (x)
    {
    case 'y':
        InFileMB << "Motherboard :\n" << MB__Name_Manufacturer << endl << MB_Chip << endl << MB_Name << endl << "Price :\n" << MB_Price << endl << "Features :\n" << "1.) " << MB_Feature1 << endl << "2.) " << MB_Feature2 << endl << "3.) " << MB_Feature3 << endl << endl;
        break;

    case 'Y':
        InFileMB << "Motherboard :\n" << MB__Name_Manufacturer << endl << MB_Chip << endl << MB_Name << endl << "Price :\n" << MB_Price << endl << "Features :\n" << "1.) " << MB_Feature1 << endl << "2.) " << MB_Feature2 << endl << "3.) " << MB_Feature3 << endl << endl;
        break;

    case 'n':
        system("cls");
        system("pause,2");
        cout << " Enter ( 1 ) to try to enter the data again or ( 2 ) to go back to item selection list .. ";
        cin >> X;
        switch (X)
        {
        case 1:
            goto MotherBoardEntry;
            break;
        case 2:
            break;
        }
        break;

    case 'N':
        system("cls");
        system("pause,2");
        cout << " Enter ( 1 ) to try enter the data again or ( 2 ) to go back to item selection list .. ";
        cin >> X;
        switch (X)
        {
        case 1:
            goto MotherBoardEntry;
            break;
        case 2:
            break;
        }

        break;
    }

}

 }