C++ 指定输出宽度和填充
#include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << 123 << endl; cout.width(10); cout << 123 << endl; cout << 123 << endl; cout.width(1); cout << 123 << endl; cout.width(10); cout.fill('*'); cout << 123 << endl; cout.width(10); cout << 123 << endl; return 0; }