我用cin.get()讓程序暫停並等待用戶輸入,並且它工作正常。當我把它放在if語句中時,它只是跳過那個「等待」期並繼續使用代碼?我該如何解決這個問題。這是不工作的部分。cin.get();當我把它放在一個if語句中不起作用
do
{
cout << "\n\n\nEnter the number of one of the following and I will explain!\n";
cout << "1.integer 2.boolian 3.floats 4.doubles 5.character";
cout << "\n\n[when you are done type 'done' to continue]\n\n";
cin >> option;
if (option = 1);
{
cout << "\nInteger is the variable abbreviated as 'int' this allows C++ to only";
cout << "\nreadwhole and real numbers \n\n";
cin.get(); //this is the part where it just skips.. it should wait
}
} while (var = 1);
由於@ 0x499602D2指出了我的答案的評論,你有一堆其他問題。確保你閱讀了這些評論。 –