In python, the following instruction: print \'a\'*5 would output aaaaa. How would one write something similar in C++ in conjunction with std:
print \'a\'*5
aaaaa
std:
The obvious way would be with fill_n:
fill_n
std::fill_n(std::ostream_iterator(std::cout), 5, 'a');
Another possibility would be be to just construct a string:
std::cout << std::string(5, 'a');