Examples do not get much more simple than this!

#include <iostream>

using namespace std;

int main ()
{
cout << "Hello World!" << endl;
return 0;
}

return(0) means “I am done, good-bye” this means that the program will run and immediately disappear. From Visual studio we may want to see what it did before it goes away so instead of “returning” to what we were doing before, we will ask the system to wait by using“

  system("pause");

  return 0;

So the improved version looks like:

#include <iostream>

using namespace std;

int main ()
{
cout << "Hello World!" << endl;
system("pause");
return 0;
}