I start using Borland Command Line Compiler with TextPad. But when I
write programs use "cin" to read console entry, output in the textpad is not sohwn. Like:
int a;
cout<<"Enter a unmer";
cin>>a;
cout<<"You Entered"<<a;
When I run this in console it works , but when I run this in textpad , it does not let me enter a number and it directly writes the
You Entered 8069560
C++ Borland Compiler
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 3
- Joined: Mon Jun 23, 2003 2:50 am
C++ Borland Compiler
Thank you very much for the reply, I unchecked the capture output,
but this time after I put the value that cin will read, when I hit enter console disaapears
but this time after I put the value that cin will read, when I hit enter console disaapears
Re: C++ Borland Compiler
Also, you should keep in mind when writing C++ code that the runtime is not required to immediately output your text when sending data to a stream. So, if you want to guarantee that the text you send to cout gets displayed before it waits for input from cin, you should "send" either endl or flush to cout. Thus:
std::cout << std::endl;
OR
std::cout << std::flush;
Regards,
Rich
std::cout << std::endl;
OR
std::cout << std::flush;
Regards,
Rich