I have a function that iterates through some parallel arrays and prints the contents at the loop control variable. I have another that is used throughout my program to print the names associated with the ID at value of loop control variable. Here are the 2 functions
void PrintName(int ID) { switch (ID) { case 0: cout << "computer(s)"; break; case 1: cout << "pencil(s)"; break; case 2: cout << "pen(s)"; break; case 3: cout << "book(s)"; break; case 4: cout << "beer(s)"; break; case 5: cout << "ruler(s)"; break; case 6: cout << "stereo(s)"; break; case 7: cout << "refrigerator(s)"; break; case 8: cout << "desk(s)"; break; case 9: cout << "backpack(s)"; break; } } void PrintSummary(InvIDList invIDs, ItemQuantity itemQuant, int totalWeight, int totalPurch, int budget) { cout << "ID NAME QUANTITY" <<endl; cout << "--------------------------" <<endl; for(int i = 0; i < 10; i++){ cout << invIDs[i]; PrintName(i); cout << itemQuant[i] <<endl; } cout << "\n\nTotal Amount Spent: $" << totalPurch <<endl; cout << "Amount of Budget Remaining: $" << budget <<endl; cout << "Total Weight of Items Purchased: " << totalWeight <<endl; } I want the output to align nicely under ID, NAME, and QUANTITY, with ID being leftmost, QUANTITY being the rightmost, and NAME centered. Unfortunately I cannot figure out how to achieve this after hours of tinkering with the code, mainly getting QUANTITY aligned all the way to the right.