printf与cout同时使用的问题

printf("A\n");  
cout<<"B\n";   
printf("C\n");

the ouput  is :  
  A  
  C  
  B   
not:  
  A  
  B  
  C 
why? 

answer:    
you   shouldn't   mix   "printf()"   and   "cout"   in   the   same   program   because   C   stdio   and   C++   iostreams   are   completely   independent   and   they   may   have   different   buffering   scheme   and   they   don't   share   the   same   buffer,   so   the   ouput  may   come   out   in   an   order   that   you   are   not   expecting,   that   is   probably   what   happened   in   your   case.

你可能感兴趣的:(c,Scheme,buffer)