Do you mind explaining how that fixed it though? I have a hard time understanding how left and right work, and then knowing if to put them before or after setw().
You need to set the attributes to the ostream, that you want applied before you send the string | int | etc... to the ostream, othwerwise the string etc won't exhibit the attribute you intended it will use the attributes that have already been set.