VS 2017 C++ 运行完程序后迅速关闭窗口(不让窗口一闪而过的方法)——解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zaishuiyifangxym/article/details/82932057

VS 2017中 程序运行完后,希望窗口继续保留。

方法一

在 return 0; 语句前面添加一句:system("pause");  下面是测试程序;

#include<iostream>
int main()
{
	using namespace std;
	cout << "Come up and C++ me some time.";
	cout << endl;
	cout << "You wont't regert it!" << endl;
	system("pause"); 
	return 0;
}

运行结果:

方法二

在 return 0; 语句前面添加一句:cin.get();  下面是测试程序;

#include<iostream>
int main()
{
	using namespace std;
	cout << "Come up and C++ me some time.";
	cout << endl;
	cout << "You wont't regert it!" << endl;
	cin.get();
	return 0;
}

运行结果:

猜你喜欢

转载自blog.csdn.net/zaishuiyifangxym/article/details/82932057
今日推荐