int main()
{
cout << "Buy or sell (b/s): " << endl;
string buy_sell;
cin >> buy_sell;
.....
}
When i try to step through this in Xcode, it stops at the cin >> buy_sell line, because it’s waiting for the user input. How do I enter the value in the debugger? I’m using Xcode 3.2.1.
(I know I could just comment out the cin lines and define the variable in the code for debugging purposes, but that would be very tedious, and I feel like there should be an easy way to enter input that I just don’t know about.)
Are you using the XCode console? You can access it under the “Run” menu, just below the Debugger. The shortcut is
command-shift-R. From there you can interact with the application exactly like a terminal, but from inside of XCode itself.