190,471 views
13 votes
13 votes
Follow the instructions for starting C++ and viewing the Introductory21.cpp file, which is contained in either the Cpp8\Chap11\Introductory21 Project folder or the Cpp8\Chap11 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) The program should calculate the average stock price stored in the prices array. It then should display the average price on the screen. Complete the program using the for statement. Save and then run the program.

User Yann Moisan
by
3.0k points

1 Answer

17 votes
17 votes

Step-by-step explanation:

I would use a for loop cycling through the array and adding the arrays values into a variable, then keep track of how many items in the array you have. Finally divide the total by the amount of stock prices and output it.

User Manre
by
3.2k points