Hi there, I have got an assignment, our teacher told us to create a program which displays result based on the inputs and displays the data, he told us to use setw to align the output, I am getting a problem.
For example,This is the output I get:
Name: Total marks: Marks obtained: Grade:
NameExample 30 20 B
NameEx 30 15 D
NameExxx 30 10 F
I want to get it in the proper order, no matter how many alphabets does the name have,like this:
Name: Total marks: Marks obtained: Grade:
NameExample 30 20 B
NameEx 30 15 D
NameExxx 30 10 F
I have tried changing the value of setw, but it doesn't help, rest of the program works fine, I just need help with aligning.
Don't use \t for internal spacing - different consoles, text editors, IDEs, etc. all treat tabs differently and some even allow the user to change the treatment of tabs. Are tabs 2, 3, 4, 8 characters? Do they always add that many characters or just enough to get to the next alignment point? You never know.