Question
1) Using enclosed file Introductory21.cpp. The program should calculate the average stock price stored in the prices array. It then should display the average price
1) Using enclosed file Introductory21.cpp. 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. Run the program screen-shot your solution and upload both your results and code.
//Introductory21.cpp - Displays the average stock price //Created/revised byon #include #include 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
2)In this exercise, you create a program that generates and displays six unique random integers for a lottery game. Each lottery number can range from 1 through 54 only. Create a program that generates six unique random integers from 1 through 54 and then displays the integers on the screen, then run the program and take a screen-shoot of your results and include it with your code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started