Here's a small sample of what iomanip has:
#include <iostream>
#include <iomanip>
int main(int argc, char** argv) {
std::cout << std::setw(20) << std::right << "Hi there!" << std::endl;
std::cout << std::setw(20) << std::right << "shorter" << std::endl;
return 0;
}
There are other things you can do as well, like setting the precision of floating-point numbers, changing the character used as padding when using setw, outputting numbers in something other than base 10, and so forth.
http://cplusplus.com/reference/iostream/manipulators/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…