1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <iomanip>
int main()
{
const char* const text[] = { "This is some short text.",
"This is more text, which is quite somewhat longer.",
"This is some intermediate length text." };
std::cout << std::setfill( '.' ) ;
std::cout << "deafult aligned\n\n" ;
for( const char* cstr : text ) std::cout << std::setw(60) << cstr << '\n' ;
std::cout << "\n\n" << "left aligned\n\n" << std::left ;
for( const char* cstr : text ) std::cout << std::setw(60) << cstr << '\n' ;
std::cout << "\n\n" << "right aligned\n\n" << std::right ;
for( const char* cstr : text ) std::cout << std::setw(60) << cstr << '\n' ;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
echo && g++ -std=c++17 -O3 -march=native -Wall -Wextra -pedantic-errors main.cpp && ./a.out && echo -e '\n\n==============\n\n'
echo && clang++ -std=c++17  -stdlib=libc++ -O3 -march=native -Wall -Wextra -pedantic-errors main.cpp -lsupc++ && ./a.out

deafult aligned

....................................This is some short text.
..........This is more text, which is quite somewhat longer.
......................This is some intermediate length text.


left aligned

This is some short text.....................................
This is more text, which is quite somewhat longer...........
This is some intermediate length text.......................


right aligned

....................................This is some short text.
..........This is more text, which is quite somewhat longer.
......................This is some intermediate length text.


==============



deafult aligned

....................................This is some short text.
..........This is more text, which is quite somewhat longer.
......................This is some intermediate length text.


left aligned

This is some short text.....................................
This is more text, which is quite somewhat longer...........
This is some intermediate length text.......................


right aligned

....................................This is some short text.
..........This is more text, which is quite somewhat longer.
......................This is some intermediate length text.