后臺進(jìn)程里一直還關(guān)不了這個運(yùn)行臺程序,每次都要退出重進(jìn),怎么解決?。?br>
#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;
}
業(yè)精于勤,荒于嬉;行成于思,毀于隨。
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");.
#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.