Question: 1. Define an int const named NUM_EXPENSES and set it to 7. 2. Define an array named expenses of seven double values with these initial

1. Define an int const named NUM_EXPENSES and set it to 7.

2. Define an array named expenses of seven double values with these initial values: 45.25, 49.38, 12.75, 123.50, 8.25, 19.95 and 145.70.

3. Define and initialize a pointer named ptr that can point to a double.

4. Iterate through the array using ptr to calculate the total and average of the expenses.

5. Reporting. Write a block of code to print a report. The block of code should print the report header first. Then use the pointer variable to iterate through the expenses array to print the expenses. Finally print the total and the average. The output should look exactly as follows (single space).

 # Amount ---------------------- 1 45.25 2 49.38 3 12.75 4 123.50 5 8.25 6 19.95 7 145.70 Total 404.78 Average 57.83

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!