Hello,
I don't know why the while_loop doesn't execute with CIN statement. It printed the statement before entering the loop, but it seems not entering the loop at all, even one time. When I entered the end-of-file command (CTRL - D) after the word: "jumped", the window disappeared. Attached are snapshots. Thank you very much.
Best regards,
No error, but the loop doesn't executed.
-
- CodeLite Curious
- Posts: 7
- Joined: Thu Aug 13, 2020 4:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
No error, but the loop doesn't executed.
You do not have the required permissions to view the files attached to this post.
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: No error, but the loop doesn't executed.
Hi,
This is a CodeLite forum. Your question seems to be language-related, not about CodeLite. I suggest you ask elsewhere e.g. stackoverflow.
Regards,
David
This is a CodeLite forum. Your question seems to be language-related, not about CodeLite. I suggest you ask elsewhere e.g. stackoverflow.
Regards,
David
- Jarod42
- CodeLite Expert
- Posts: 240
- Joined: Wed Sep 30, 2009 5:54 pm
- Genuine User: Yes
- IDE Question: C++
- Location: France
- Contact:
Re: No error, but the loop doesn't executed.
You might use debugger to verify your assumption (add breakpoint inside the loop).
Currently, you don't flush output, so it might just not been yet displayed and waiting for new input.
Currently, you don't flush output, so it might just not been yet displayed and waiting for new input.
-
- CodeLite Curious
- Posts: 7
- Joined: Thu Aug 13, 2020 4:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: No error, but the loop doesn't executed.
Thanks, Jarod42. It does work with Windows 10 system, but not with Linux-Debian 10 O.S. The only difference was the end-of-file key. Attached is the output (snapshot).
Regards,
Regards,
You do not have the required permissions to view the files attached to this post.
- Jarod42
- CodeLite Expert
- Posts: 240
- Joined: Wed Sep 30, 2009 5:54 pm
- Genuine User: Yes
- IDE Question: C++
- Location: France
- Contact:
Re: No error, but the loop doesn't executed.
Which terminal do you use? I suspect that terminal used on linux closes itself on Ctrl-D.
You might try different terminal in Settings/Preferences/Terminal
You might try different terminal in Settings/Preferences/Terminal
-
- CodeLite Curious
- Posts: 7
- Joined: Thu Aug 13, 2020 4:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: No error, but the loop doesn't executed.
Thank you very much, Jrod42. You're correct. The problem was terminal. I have never suspected the problem was caused by terminal. You can see a new output from the snapshot attached.
Regards,
Regards,
You do not have the required permissions to view the files attached to this post.
- Jarod42
- CodeLite Expert
- Posts: 240
- Joined: Wed Sep 30, 2009 5:54 pm
- Genuine User: Yes
- IDE Question: C++
- Location: France
- Contact:
Re: No error, but the loop doesn't executed.
Unrelated to codelite.
As I previously said, you don't **flush** output (`std::flush` or `std::endl`) so `std::cout` is only flushed automatically (when internal buffer is full) or on destruction..
As I previously said, you don't **flush** output (`std::flush` or `std::endl`) so `std::cout` is only flushed automatically (when internal buffer is full) or on destruction..
-
- CodeLite Curious
- Posts: 7
- Joined: Thu Aug 13, 2020 4:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: No error, but the loop doesn't executed.
Thank you very much, Jarod42. I was using endl, but still need to pressed the "Enter key" to get the last cout. However, I hit the "Enter key" without pressing CTR-D by mistake, then all printed out. So, I don't understand why CTR-D is not needed. Please see the attached snapshot.
Best regards,
Best regards,
You do not have the required permissions to view the files attached to this post.