// 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
时间: 2024-11-13 08:05:01