![]() |
Flush cout output carefully
On 6th July, 2005
|
|
Flush cout output carefully
Authorshabbir ( Go4Expert Founder )
Recent Articles
Similar Articles
Code: cpp
The reason behind this is cout is not flushed and you can get the desired out put by doing Code: cpp
Thanks Shabbir Bhimani |
|
|
#2 |
|
Go4Expert Member
Join Date: Oct 2005
Location: Ankara/Turkey
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Re: Flush cout output carefully
Wov, that's really interesting. In which header flush() is defined in? stdio.h or iostream.h? |
|
|
|
|
|
#3 | |
|
Go4Expert Founder
![]() |
Re: Flush cout output carefullyQuote:
|
|
|
|
|
|
|
#4 |
|
Team Leader
![]() Join Date: Dec 2006
Location: Texan now in Central NY
Posts: 834
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 3 ![]() |
Re: Flush cout output carefully
I might mention that iostream.h is deprecated and is provided for backward compatibility. One should use iostream without an extension. The phenomenon occurs because cout and printf use two different streams; they may, however, be synced. It is generally not good practice to mix the two forms.
__________________
DaWei on Pointers Grumpy on C++ Exceptions Functionality rules; clarity matters. If you can work a little elegance in there, you're stylin'. |
|
|
|
|
|
#5 |
|
Team Leader
![]() Join Date: Dec 2006
Location: Texan now in Central NY
Posts: 834
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 3 ![]() |
Re: Flush cout output carefully
Forgot to mention that "void main" is non-standard code. The standard specifies that main return an int. Some compilers, particularly less compliant ones, accept the void specification, but its use is non-standard and not recommended practice.
__________________
DaWei on Pointers Grumpy on C++ Exceptions Functionality rules; clarity matters. If you can work a little elegance in there, you're stylin'. |
|
|
|
|
|
#6 | ||
|
Go4Expert Founder
![]() |
Re: Flush cout output carefullyQuote:
Quote:
|
||
|
|
|
|
|
#7 |
|
Ambitious contributor
Join Date: Feb 2008
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 ![]() |
Re: Flush cout output carefully
i will try to use flush now
|
|
|
|
![]() |
|
| Currently Active Users Reading This Article: 1 (0 members and 1 guests) | |
| Article Tools | Search this Article |
| Display Modes | |
| Bookmarks | |
|
|