我用過visual studio 2012,這是我第一次使用它。我開始問心無愧.exe窗口退出
新→項目,空→項目源然後文件 - 添加→新項目,cpp文件並輸入以下代碼:
#include <iostream>
using namespace std;
int main()
{
int cents;
int dollars, quarters, dimes, nickels, pennies;
cout << "Enter total cents: ";
cin >> cents;
dollars = cents/100;
cents = cents - dollars*100;
quarters = cents/25;
cents = cents - quarters*25;
dimes = cents/10;
cents = cents - dimes*10;
nickels = cents/5;
cents = cents - nickels*5;
pennies = cents;
cout << "This corresponds to "
<< dollars << " dollars, "
<< quarters << " quarters, "
<< dimes << " dimes, "
<< nickels << " nickels, and "
<< pennies << " pennies.\n\n";
return 0;
}
我想製作一個程序,將美分分爲dollars
,quarters
,nickels
,dimes
和pennies
,.exe
窗口成功形成,但我輸入美分數後,我想轉換窗口消失。斷點或系統(「暫停」)似乎不起作用。這裏是信息:
'Project2.exe' (Win32): Loaded 'C:\Users\dell\Documents\Visual Studio 2012\Projects\Project2\Debug\Project2.exe'. Symbols loaded. 'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file. 'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file. 'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file. 'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded. 'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded. The thread 0xe24 has exited with code -1073741749 (0xc000004b). The program '[7476] Project2.exe' has exited with code -1073741510 (0xc000013a).
我怎樣才能保持.exe
窗口,看到的結果?
」斷點或系統(「暫停」)似乎不起作用。「你一定犯了錯誤,因爲這兩者都應該正常工作。 –
@MooingDuck:他在*寫任何輸出之前暫停*,這顯然不起作用。他的代碼實際上沒有寫任何東西,直到它從'main'返回。 –