#include <iostream> #include <iomanip> using namespace std; int main() { int a,b,c; cin >> a >> b >> c; cout << a << setw(8) << b << setw(8) << c; return 0; }
本题考查setw函数用法,setw函数控制场宽。
用法:cout << …… << setw(数字) << ……;
#include <iostream> #include <iomanip> using namespace std; int main() { int a,b,c; cin >> a >> b >> c; cout << a << setw(8) << b << setw(8) << c; return 0; }