The output is not aligned when printing the multiplication table
Control the width of the output through the setw() function
Go to the blog settings page, choose a code piece highlighting style you like, the same highlighting is shown below 代码片
.
cout << setw(2) << std::left << i*j << " ";
Set the output width to 2, left-justified
Still feel uncomfortable, the first column also shows the width of 2, the result is only one
The above is from the programming training articles learned by C++ teacher Rock