3

I was using my code::blocks v10.05 compiler when I came across something strange. It when I was about to add a carriage return, it suggested endl, and then automatically put this:

    cout << "The age of " + age + " isn't that bad. Embrace it" << endl();

can the endl method take parameters?

4

2 に答える 2

11

endlはマニピュレータ関数です:

ostream& endl ( ostream& os );

それをストリームに連結することができます:

cout << endl;

または、ストリームを引数として関数に渡します。

endl(cout);
于 2012-08-11T06:10:13.620 に答える
-1

私はそれについて知りませんでしたが、出力ストリームをそれに渡すことができるようです。これは私がオンラインで見つけたものです:)

http://www.cplusplus.com/reference/iostream/manipulators/endl/

于 2012-08-11T06:10:35.157 に答える