Basically i am running a simple program in Xcode Version 8.3 (8E162)
#include
using namespace std;
int main() {
int a;
You already solved your problem yourself: std::cout uses buffered output and should always be flushed. You can achieve this by either using std::cout << "What is your age? << std::flush, by using std::cout.flush() or by adding a line break like std::endl which flushes implicitly.
A complete solution could look like this:
#include
using namespace std;
int main() {
int a;
cout << "What is your age: " << flush;
cin >> a;
cout << "My age is " << a << endl;
return 0;
}