I am trying to understand system calls made in c++ using system("some command"). here's the code
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout << "Hello ";
system("./pause");
cout << "World";
cout << endl;
return 0;
}
the executable "pause" is created from the following code
#include <iostream>
using namespace std;
int main()
{
cout<<"enter any key to continue\n";
cin.get();
return 0;
}
I get the following output
enter any key to continue
1
Hello World
Can someone please explain the output to me? I was expecting this -
Hello
enter any key to continue
1
World