您的位置:首页 > 其它

关于解决Win32控制台程序编译后自动退出

2015-01-18 08:55 513 查看

问题描述:Win32控制台程序编译运行后自动退出,看不到结果,解决此问题有如下几种方法:

使用CTRL+F5进行编译;
使用getchar()函数,放在程序的最后;
使用system("pause")函数,放在程序的最后;

#include <iostream>
//#include <stdio.h>
using namespace std;

struct point
{
int x;
int y;
void output()
{
cout<<x<<endl<<y<<endl;
}
};
void main()
{
point pt;
pt.x = 5;
pt.y = 5;
pt.output();
getchar();
//system("pause");
return;
}


还有更多方法,但是以上是最常用的,最简单的方法!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: