I wrote a program to read names and program scores from a text file and the output has to be formatted into columns evenly like so:
Currently it looks like this:Code:Snow White 89.50 89.00 B Sleeping Beauty 89.50 89.00 B
I can't adjust the lengths to the individuals names because it's read from a file, I've played around with different setw() lengths and left and right alignment and can't get it to format properly. Here's the code:Code:Snow White 89.50 89.00 B Sleeping Beauty 89.50 89.00 B
Any help would be greatly appreciated!Code:cout<<left<<firstName<<" "<<lastName <<right <<setw(15)<<average1 <<setw(10)<<average2 <<setw(10)<<average3 <<setw(6)<<grade<<endl;



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.