How can you print a line of 55 "-" without typing all 55 characters?
When an output value needs fewer character positions than the output field, the value is padding with the 'fill' character either on the left or on the right depending on the justification desired.
The fill character, by default, is a blank.
But you can change the fill character. For example, you can make the fill character be '-'.
Then to print 55 '-' characters:
- change the fill character to '-'
- print an empty string in a field of width 55
- change the fill character back to a blank
cout.fill('-'); cout << setw(55) << "" << endl; cout.fill(' ');