C++ printing spaces or tabs given a user input integer

The Solution to C++ printing spaces or tabs given a user input integer is


Just use std::string:

std::cout << std::string( n, ' ' );

In many cases, however, depending on what comes next, is may be simpler to just add n to the parameter to an std::setw.

~ Answered on 2013-04-08 16:35:22


Most Viewed Questions: