Problem debugging when using iostream cin after cout
Posted: Mon Aug 15, 2011 11:37 pm
Hi, I'm trying to run the CodeLite debugger on a very very simple C++ program, such as:
If I have no "\n" newline or << endl at the end of the cout, this will not work properly in the CodeLite debugger. I've tried this in the most recent version on both Ubuntu Linux and Mac OS X. The "cin" never assigns whatever is typed in the debugger window to the local variable which remains 0. I tried various cout.flush() and cin.sync() operations to no avail. However, adding a simple newline fixes this problem, but, of course, prompts for user input on a new line. I should add that this code runs as expected in the terminal.
Any suggestions would be greatly appreciated.
Code: Select all
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int number;
cout << "Enter a Number: ";
cin >> number;
cout << "Your Number Was: " << number;
return 0;
}
Any suggestions would be greatly appreciated.