Can you help me solve this Its for computer science 914 any
Can you help me solve this?
It\'s for computer science
9.14 any and average. the .ale. rugures for number of days. The figures are etored in a allocated array. include ciostreano finelude ing namespace etda a int maint) mullpur, to dynanieally alloeate an array double sales Mocumulator To hold average average To hold the number of days of sales int numbaye Counter variable Get the number of days of sales cout ec -Bow many days of sales figures do you vieh eout \"to process ein numDa Dynamically allocate an array large enough to hold 21 that many days of sales amounts. 23 sales new doublet numDays 25 Get the sales figures for each day. Enter the sales figures below. n\": 26 27 for (count numDays: count++) 0: cout Day count 1) 29 cin sales[counts 31 calculate the total sales 33 for (count 0: count numDays count++) 34 35 total sales [count 36 30 Calculate the average sales per day 39 average total numDays: 40 41 Display the results 42 cout fixed showpoint setprecision(2): cout cc \"VnInTotal sales s- total endl 44 cout \"Average sales S\" average endl: 45 47 Free dynamically allocated memory delete sales: 48 sales nullptr: Make sales a null pointer 49 return Program output with Example Input shown in Bold How many days of sales figures do you wish to process? s Enterl Enter the sales figures below. Day 1: 898.63 [Enter] Day 2 652.32 [Enter] Day 3: 741.85 [Enter] Day 4: 852.96 [Enter] Day 5: 921.37 [Enter] Total sales: $4067.13 Average sales: $813.43 Solution
double *sales is allocated on HEAP.
Reason:
This is Dynamically allocated and by default it is on HEAP.
total is allocated on STACK.
Reason:
This is Statically allocated and by default it is on STACK.
sales[numDays] is allocated on HEAP.
Reason:
Since sales is dynamically allocated, sales[numDays] is also on HEAP.
