← Back to Structs
Question 416
Total Cost of an Order
Total Cost of an Order
An array of threestruct Itemvalues each has apriceand aqty. The items are{5, 2},{3, 4}, and{10, 1}. Compute the order total by summingprice * qtyover all items and print it (see Expected Output). That is5*2 + 3*4 + 10*1 = 10 + 12 + 10 = 32. There is no trailing newline.
Expected Output:
32= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.