Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何格式化我的控制台输出,使其与 C++ 中的右侧对齐?
使用操纵器标志std::right
std::right
例子
或者
这有效...
#include<iostream> using std::cout; using std::endl; #include<iomanip> using std::setw; int main(){ int x = 12345; cout << "Blah Blah Blah" << endl << setw(80) << x << endl; system("pause"); return 0; }