Xcode 8.3 c++ issues using cout and cin on same line

When using Cin imediately after a cout, there seems to be some issues when building and using the debug terminal.


#include <iostream>

int main(int argc, const char * argv[]) {
    // insert code here...
    int num;
    std::cout << "Testing: ";
    std::cin >> num;
    std::cout << "input was " << num << std::endl;

    return 0;
}


Using the above code as a test case, one would expect the output to be:


Testing: <wait for input>


------


Testing: 12
input was 12

------


However the actual terminal input and output runs as such:


12
Testing: input was 12
Program ended with exit code: 0


Surely something is wrong here with the 8.3 update to Xcode as this worked before.

I am actually experiencing the same problem in my intro to C++ class, it has been driving me (and the professor) crazy! Really wish Apple would address the problem soon so I can get back to learning to code without such a hassle!

Download xcode 8.2.1 from here https://developer.apple.com/download/more/

put current xcode on your system in trash and empty trash

unzip 8.2.1 and enjoy a working xcode.

Man, I thought I was the only one. I haven't done many command line C++ applications for some time, as I've been working on some GUI applications, but I came back to some older C++ command line projects and found them to be broken. My cout statements were not being displayed at all unless I put a newline after. Glad to see this is just a bug and not something happening to just me.


So, has anyone had an update from the bug reports? I'm on 8.3.1 and this is still happening.

Note Xcode 8.3.2 out today claims to correct the output issue mentioned as - "debug console would not show output until a new line was printed"

Xcode 8.3 c++ issues using cout and cin on same line
 
 
Q