我是編程的一般相對新手,我在這段代碼中遇到了問題。C++不能識別空格
cout << "what would you like to have inside that?" << endl;
cout << "please enter a sentance" << endl;
cin.sync();
cin >> time[d];
cout << "Is this what you wrote?" << endl;
cout << time[d]<< endl;
system("pause");
它不會越過該空間並僅在它之前輸出。
你是什麼意思***不經過空間***? –
getline(std :: cin,time [d])''。就「>>」而言,任何空格都是分隔符。 – cHao
如果你不知道它的作用,請不要使用sync()。此外,格式化的輸入由空白分隔。 – 0x499602D2