在用vs2010遇到的问题,求大神清晰的解答!!
#include<iostream>
using namespace std;
int max(int i,int j){
if(i>=j)return i;
else return j;
}
int main(void){
cout<<"输入i,j:";
int i,j;
cin>>i>>j;
cout<<"最大数是:"<<max(i,j)<<'\n';
return 0;
}
在VS2010下执行之后,生成有窗口有输入内容,但是输入数字之后,enter无法得到最终结果,就是一闪而过
“a.exe”: 已加载“C:\Documents and Settings\Administrator\桌面\RPG游戏\a\Debug\a.exe”,已加载符号。
“a.exe”: 已加载“C:\WINDOWS\system32\ntdll.dll”,Cannot find or open the PDB file
“a.exe”: 已加载“C:\WINDOWS\system32\kernel32.dll”,Cannot find or open the PDB file
“a.exe”: 已加载“C:\WINDOWS\system32\msvcp100d.dll”,已加载符号。
“a.exe”: 已加载“C:\WINDOWS\system32\msvcr100d.dll”,已加载符号。
程序“[2736] a.exe: 本机”已退出,返回值为 0 (0x0)。
[解决办法]
程序的最好用system("pause")暂停,这样方便看到控制台输出的信息,然后按键退出。
[解决办法]
[解决办法]
最后加一个 getchar();