在VC2010调试或执行EXE文件时,程序运行结束后自动退出了,想看到打印 可以采用几种方法:
1、按ctrl+F5只执行不调试
2、在cmd中手动调用 而不是直接点
3、加入getchar
#include <iostream>
using namespace std; int main(void)
{
cout<<"welcome!";
getchar();
return 0;
}
这样输入任意值可以退出
4、调用系统函数
#include<stdio.h>
#include<stdlib.h> void main(void)
{
int a=10,b=36;
printf("%d+%d=%d",a,b,a+b);
system("pause");
}