Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that does the following: Creates an array of int called temperatures with 7 elements. Initialize the array with the following values:

Write a C++ program that does the following:

Creates an array of int called temperatures with 7 elements.

Initialize the array with the following values:

30, 31, 60, 65, 75, 71, 112

Create a void function called calculateTemps which takes in the array of temperatures. It will also take in three variables of type double which are passed by reference and are named highest, avg, and numTempsFreezing. In the body, this function will calculate the three values based on the array

- The highest temperature

- The average temperature

- The number of temperatures at or below 32 (freezing in Fahrenheit)

And these values will be assigned to the corresponding variables.

From main, call the function calculateTemps and display the three values which are the highest and average temperatures and also the number of temperatures below freezing of the provided array as determined by the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions