CJCoding With Joseph
15per day

Receipt Formatting

Create three float variables: price1 = 12.99f, price2 = 8.50f, and price3 = 15.25f. Calculate the total and use cout with setprecision to create a formatted receipt:

Item 1: $12.99
Item 2: $8.50
Item 3: $15.25
Total: $36.74

Each price should be displayed with exactly 2 decimal places using fixed and setprecision(2). Calculate the total by adding all three prices together.

Expected Output:

Item 1: $12.99
Item 2: $8.50
Item 3: $15.25
Total: $36.74
Topics:
Printing
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.