关于 setw() 函数(C++)

// about setw()
#include <iostream>
#include <iomanip>
#include <cstring>


using namespace std;

int main()
{
    string name = "wangyang"; // generate a string
    cout << setiosflags(ios::right) << setfill('a') << setw(20) << name << endl; // control the word count, the alignment, the fill

    return 0;
}

原文地址:https://www.cnblogs.com/zijidefengge/p/12094337.html