Help fix errors in code.
Follow the instructions for starting C++ and viewing theIntroductory21.cpp file, which is contained in either theCpp8\Chap11\Introductory21 Project folder or the Cpp8\Chap11folder. (Depending on your C++ development tool, you may need toopen the project/solution file first.) The program should calculatethe average stock price stored in the prices array. It then shoulddisplay the average price on the screen. Complete the program usingthe for statement. Save and then run the program.
//Introductory21.cpp - Displays the average stock price
#include <iostream>#include <iomanip>using namespace std;
int main()
{ double prices[10] = {96.5, 100.5, 100.5,100.5, 99, 99, 99, 100, 98.5, 98.9}; double total = 0.0; double average = 0.0;
cout << fixed <<setprecision(2); cout << "Average stock price: $"<< average << endl; return 0;} //end of main function
Help fix errors in code. Follow the instructions for starting C++ and viewing the Introductory21.cpp file, which is cont
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am