c++ - XCode 4 only displaying cout statements with endl -


I have a very strange one with direct statement, for example, if I write, then < Pre> cout & lt; & Lt; "This Works" & lt; & Lt; Endl; Cout & lt; & Lt; "This is not"; Cout & lt; & Lt; Memory size limit & lt; & Lt; "Block of available memory." & Lt; & Lt; Endl;

I see all three output statements in my debugger console. However, if I change the order,

  cout & lt; & Lt; Memory size limit & lt; & Lt; "Block of available memory." & Lt; & Lt; Endl; Cout & lt; & Lt; "This Works" & lt; & Lt; Endl; Cout & lt; & Lt; "This is not";   

I only look at the first two cutouts. Even strangers, if I change the code,

  cout & lt; & Lt; Memory size limit & lt; & Lt; "Block of available memory." & Lt; & Lt; Endl; Cout & lt; & Lt; "This Works" & lt; & Lt; Endl; Cout & lt; & Lt; "It's Not" & lt; & Lt; Endl;   

I look at all the three statements.

Why can not I see that when I change my situation "is not it" time to say?

std :: cout is a stream and usually Buffer is given if you print endl the stream is flushed ( cout is same as cout & lt; & Lt; "\ n" & lt; flush .

You can manually stream the cout (or Cout.flush () ).

Then it should print:

  cout  < Is "& lt;    

Comments