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.
换句话说,我想要它让数字排成一行。但是,我无法让我的代码做到这一点。这是我的代码:
for (int s=0; s < 4; s++) { cout << left << setw(200) << fuit[s] << ": "; for (int x=0; x <13; x++) { cout << right << setw(2) << fuit[s][x]; }
问题在这里:
cout << left << setw(2) << suit[s] << ": ";
在这里,您将对齐设置为左,宽度设置为 2。您会希望它右对齐并具有更大的宽度。