VS2012 after the input code executes, the screen flashes over and the display box does not appear:
#include <iostream>
int main ()
{
using namespace Std;
const int arsize = 20;
Char Name[arsize];
Char Dessert[arsize];
cout << "Enter your name:\n";
Cin.getline (name,arsize);
cout << "Enter your favorite dessert:\n";
Cin.getline (dessert,arsize);
cout << "I have some delicious" <<dessert;
cout << "For You," <<name<< ". \ n";
return 0;
}
There is no black box (command-line window) because it finished ... cout << "for You," <<name<< ". \ n", then return directly to 0, which is executed, so it will close, So you can add a system ("pause") before return, and you may see the output. The following procedures are followed:
#include <iostream>
int main ()
{
using namespace Std;
const int arsize = 20;
Char Name[arsize];
Char Dessert[arsize];
cout << "Enter your name:\n";
Cin.getline (name,arsize);
cout << "Enter your favorite dessert:\n";
Cin.getline (dessert,arsize);
cout << "I have some delicious" <<dessert;
cout << "For You," <<name<< ". \ n";
System ("pause");
return 0;
}
Why C + + Why code execution appears a black box (command Window) a flash over the workaround