How to use cout manipulator to output line feed (new line) in C++

1 Answer

0 votes
#include <iostream>

using std::cout;
using std::endl;
using std::ostream;
using std::flush;

ostream& LF(ostream& output) { return output << '\n' << flush; } 

int main()
{
	cout << "C++" << LF << LF << "C#" << endl;

	return 0;
}


/*
run:

C++

C#

*/

 



answered Apr 10, 2018 by avibootz

Related questions

1 answer 226 views
1 answer 330 views
1 answer 176 views
1 answer 202 views
1 answer 163 views
1 answer 163 views
2 answers 235 views
235 views asked Apr 6, 2018 by avibootz
...