我第一次從PHP使用C++。我正在玩一些代碼。據我的理解,cin.get();
是假設停止窗口關閉,直到我按下一個鍵,但它似乎沒有工作,因爲它之前的代碼,我不知道問題是什麼。這裏是我的代碼:cin.get()不工作?
#include <iostream>
#include <cstdlib>
using namespace std;
int multiply (int x, int y);
int main()
{
int x;
int y;
cout << "Please enter two integers: ";
cin >> x >> y;
int total = multiply(x, y);
cout << total;
cin.get();
}
int multiply (int x, int y) {
return x*y;
}
你能解釋一下你的意思嗎?「停止頁面關閉」 – 2011-12-14 05:30:29
@Tyler只是使用getch();而不是cin.get(); – StackFlowed 2011-12-14 05:39:04