std::setw is a manipulator that sets the width of the next element that is printed to a stream object with the << operator. It is very useful to create tabular (aligned) output of data.
In the next simple example, the texts (txt) are printed with a width of 19 characters while the numbers (num) are printed with a width of 4 characters.
Because numbers are typically right aligned, the manipulator std::right is also used.