← Back to Printing
Question 723
Zero-Padded Id and a Dotted Name
Zero-Padded Id and a Dotted Name
The starter already reads an item id, a name (which may contain spaces), a quantity and a unit price. Print ONE line in this layout: - the wordItem, a space, then the id right-aligned in 5 columns padded with0-:then the name right-aligned in 12 columns padded with.- a space, then the quantity right-aligned in 2 columns padded with spaces -@then the unit price with exactly two decimals, right-aligned in 7 columns -=then quantity times unit price with exactly two decimals, then a newline Remember thatsetfillstays in force until you change it, so switch back to a space before the quantity. For the input42,Hammer,3 12.5the program prints the output shown in Expected Output.
Expected Output:
Item 00042: ......Hammer 3 @ 12.50 = 37.50= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Printing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.