Hi, I am trying to create a function that shows the players inventory. I am having trouble creating a box around the desplay without the sides being pushed out too far depending on the text size. here is the code i am using:
This is not homework. I am currently working with a team to create a text based game on our offtime here at Fullsail.Code:void character::showItems(void) { using namespace std; cout << "Items\n"; cout << "#################################################\n"; cout << "# \tItem Name\t\t Quantity\t#\n"; cout << "# \t---------\t\t --------\t#\n"; int counter = 1; for (int i = 0; i < int(character::inventory.size()); i++) { if (character::inventory[i].quantity) { cout << "# " << counter << ". " << character::inventory[i].name << "\t\t" << character::inventory[i].quantity << "\t#\n"; counter++; } } character::checkInventorySpace(); // calculates current inventory space cout << "#\t\t\t\t\t\t#\n"; cout << "#\t\t\t\tTotal: " << character::currentInventorySpace << '/' << character::maxInventorySpace << "\t#\n"; cout << "#################################################\n"; }
Thank you.