How to use cout manipulator to output tab in C++

1 Answer

0 votes
#include <iostream>

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

ostream& tab(ostream& output) { return output << '\t'; }

int main()
{
	cout << tab << "c++" << tab << "java" << tab << "c" << endl;

	return 0;
}


/*
run:

            c++     java    c

*/

 



answered Apr 10, 2018 by avibootz

Related questions

1 answer 181 views
1 answer 315 views
1 answer 167 views
1 answer 187 views
1 answer 148 views
1 answer 152 views
2 answers 218 views
218 views asked Apr 6, 2018 by avibootz
...