在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");
}

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2021-11-06
  • 2021-04-17
  • 2021-10-18
  • 2021-08-23
  • 2021-12-09
  • 2022-01-28
猜你喜欢
  • 2022-12-23
  • 2021-12-06
  • 2021-12-24
  • 2021-04-24
  • 2021-06-22
  • 2021-10-14
  • 2021-12-23
相关资源
相似解决方案