strange thing in VC++
i wrote the following code snippet in Visual C++ 6.0
#include "h1.h"
int main()
{
cout<<"\nHello \n";
printf("\nWelcome!!!");
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?
#include "h1.h"
int main()
{
cout<<"\nHello \n";
printf("\nWelcome!!!");
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?
Replies
-
samboy2005i 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 . -
simpleno 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.kumarI dont know the answer but I am not convinced with your answer the reason is that if YOU HAVE
cout<<"Aaaaa";
printf("ddddd");
count<<"bbbbb";
so in this case Aaaaa and bbbb would print sep?? -
simpledddd gets printed first and then aaaa and then bbbbb
so what do you make of this??
You are reading an archived discussion.
Related Posts
I'm a B.Tech final yr student in civil engg. Can anyone suggest me some topics for my final yr project, preferably in structural engineering? Are there any websites from where...
What is the best textbook for Advanced Reinforced Concrete Design( that which involves domes, water tanks etc.) ?
I am planning to write my CCNA exam soon.i attended course long back.So forgot some concepts.I am planning to study the dumbs.i searched the net and can see many.Can some1...
plz ..
can anybody help me with the circuitry of HSS or give useful links for that ...
whether an alloy 'll serve better than a spokes wheel?
😁 😕 😕