strange thing in VC++

Status
Not open for further replies.

simple

In Runtime
Messages
171
Location
Earth
Hey guys this is a simple code snippet....

#include "h1.h"

int main()
{
cout<<"\nHello \n";
printf("\nWelcome!!!");
return 0;
}

but the output i get is "Welcome" first and then "hello".

Why is welcome statement executing first?

i have included stdio.h and iostream.h in h1.h
i am running Visual studio 6.0
any suggestions?
 
That's because the compiler still thinks your cout statement is running. All output to cout and stdout is buffered. Try adding an <<endl to the end of the cout statement and see if it works.
 
hey dude!!! thanks for that....it worked like you said it would...
again thanks a lot!!
c ya!!
 
Status
Not open for further replies.
Back
Top Bottom