Cannot give input through the console [message #676752] |
Mon, 06 June 2011 12:31 |
Santosh Messages: 2 Registered: June 2011 |
Junior Member |
|
|
Hi guys,
I have a simple 'Hello World' program here and I am trying to read the user input:
#include <iostream>
using namespace std;
int main(void) {
int i;
cout << "Hello World!!!" << endl;
cin >> i;
cout << "hello 2";
return 0;
}
I can compile and build the project but when I debug it I don't know why but the control stops at the main() function. I have to click the "Resume" button on the Debug window in order to get it moving. After that I can see the message "Hello World!!!" in the console and it stops for user input. When I type numbers on console I can see the numbers being typed in green color but when I press the 'Enter' key the cursor just goes to the next line in the console. The program doesn't continue and I don't see the second message "hello 2" printed. No matter what I do the program doesn't continue. When I browse to the .exe file and execute it manually it works as expected.
I am new to Eclipse CDT and may be doing something wrong here. Please help me solve this issue.
My Specs:
Eclipse version: Eclipse Helios CDT Service Release 2
Build id: 20110218-0911
Platform: Windows 7 x64
Toolchain: MinGW
GCC Version: 4.5.2
G++ Version: 4.5.2
GDB Version: 7.2
GNU Make Version: 3.81
[Updated on: Mon, 06 June 2011 12:31] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03441 seconds