View Feed
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12829 Members
Join this group to post and comment.
simple • Sep 8, 2008

strange thing in VC++

i wrote the following code snippet in Visual C++ 6.0
#include "h1.h"
int main()
cout<<"\nHello \n";
return 0;
strange thing is that "welcome" gets displayed first and "hello" thereafter....
why is "welcome" getting executed first??

i have included stdio.h and iostream.h in h1.h.
any suggestions?
samboy2005 • Sep 8, 2008
i think printf command has higher priority then cout .....
haven't been in touch for long time with VC++..not very sure .but think this might be the case .
simple • Sep 9, 2008
no i guess i found the answer
cout is buffered, so if i add an endl at the end of cout it works perfectly fine!!
any other reply is still welcome!!
thanks n c ya!!
niraj.kumar • Sep 10, 2008
I dont know the answer but I am not convinced with your answer the reason is that if YOU HAVE


so in this case Aaaaa and bbbb would print sep??
simple • Sep 12, 2008
dddd gets printed first and then aaaa and then bbbbb
so what do you make of this??

Share this content on your social channels -