C++ iomanip setfill() Function
Example
Fill the empty space with stars:
cout << setfill('*') << setw(8) << 42;
Definition and Usage
The setfill() function sets the character that fills the empty space when a value is shorter than the width set by setw(). The default fill character is a space.
The setfill function is defined in the <iomanip> header file.
Syntax
setfill(char c)
Parameter Values
| Parameter | Description |
|---|---|
| c | Required. The character to fill the empty space with. |
Technical Details
| Returns: | A manipulator that you use with <<. It changes the fill character for all the values printed after it. |
|---|