关于c和c++对齐输出问题

c++  : 头文件<iomanip> setiosflags(ios::left) 左对齐

cout << setw(8) << x << " "  << setw(8) << x*x << " " << setw(8) << x*x*x << endl;
cout << setw(8) << y << " " << setw(8) << y*y << " "<< setw(8) << y*y*y << endl;  

cout << setw(8) << z << " " << setw(8) << z*z << " "<< setw(8) << z*z*z << endl;

8为列数。

c语言:

猜你喜欢

转载自blog.csdn.net/weixin_62735064/article/details/121043552