cant allign using setw manipulator | Sololearn: Learn to code for FREE!

+1

cant allign using setw manipulator

The output is not properly alligned. The user enter the names and votes. Program outputs name votes recieved and percent of votes recieved by each candidate. I want to allign the outpot in a straight line but i cant. Sample input: Johnson 5000 Miller 4000 Duffy 6000 Robinson 2500 Ashtony 1800 Code: https://code.sololearn.com/c4A151a11a18

12/15/2020 9:55:57 AM

Muhammad Abdullah

3 Answers

New Answer

0

The biggest problem with aligning text is that each character differs in width. Perfect alignment is only possible where a monospace font is used to print outputs. To prove this, use 'AAA' as names for all of the candidates. The output will be well aligned when the 'name' field consists of characters having similar width.

0

Ipang that is problem the pro bn lem i want to solve. Keep same names and still align

0

I know, I wish you luck buddy 👍