Basically I am trying to setfill and setw to create a fixed table to display information stored in an array however it doesn't appear that set width is working and I'm not sure why. Here is the code I am using:
const int MAXWIDTH = 10;
cout << left << setw(MAXWIDTH) << setfill(' ') << "Stock Number";
cout << left << setw(MAXWIDTH) << setfill(' ') << "Stock Description";
cout << left << setw(MAXWIDTH) << setfill(' ') << "Order Level";
cout << left << setw(MAXWIDTH) << setfill(' ') << "Reorder Level";
The output I get is:
Either increase the column width or use two rows. The "Stock Description" has more than 10 letters. You should also allow for spaces between column titles.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.