You are viewing a single comment's thread. Return to all comments →
Good one!! :)
@meaux, that code takes advantage of stream manipulators to format the output buffer: with setw(n) you define the width of the field to display, setfill(' ') lets you choose a padding character, and string(i,'#') builds a string consisting of i times the '#' character.
I had also gone for a one liner inside the loop (not really, as I had to reset a variable on every loop iteration) using std::transform and lambdas on a char array, but this is way more elegant and readable.