![](/img/trans.png)
[英]In c++ , how do I determine when to exit my loop while converting octal numbers to decimals?
[英]How do I pause my command window when using the exit function in C++?
當用戶鍵入內容時,我希望我的功能停止並顯示一個短語。 當用戶鍵入特定的內容時,我的程序當前關閉命令窗口,但我希望它暫停以使用戶可以看到該短語。 下面是我有問題的代碼:
if (in.peek() != '/')
{
obj = Rational(top);
cout << "Bad input format for operator >>. Aborting!" << endl;
exit(1);
}
通常,實現此目標的一種好方法是:
std::cout << "Press enter to continue" << std::endl;
std::cin.ignore();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.