后台进程里一直还关不了这个运行台程序,每次都要退出重进,怎么解决啊?
#include "stdafx.h"
#include "iostream"
#include <cstdlib>
using namespace std;
int main()
{
int n = 1;
cout << n;
int nn= 3;
cout << nn;
int a[4];
for (int i = 0;i < 4;i++)
{
a[i] = i;
}
for (int i = 0;i < 4;i++)
{
cout << a[i];
}
system("PAUSE");
return 0;
}
黄舟2017-04-18 10:54:18
system("PAUSE"); Press any key to continue
However, once you do not enter any keys, then return 0; is not running and the process is not closed. This situation will occur if you compile with VS again.
After restarting the computer, try using the getch(); command to enter characters instead of system("PAUSE");.
怪我咯2017-04-18 10:54:18
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int n = 1;
cout << n;
int nn= 3;
cout << nn;
int a[4];
for (int i = 0;i < 4;i++)
{
a[i] = i;
}
for (int i = 0;i < 4;i++)
{
cout << a[i];
}
return 0;
}
With slight modifications, everything works fine in the G++ environment.
Test the VS environment now.
Update:
Everything is normal in VS2015 environment.
Please provide more information.