Question: Need help in C++ I got stuck in question 2 and 3 1. Declare an array named temperatures and initialize it with the values 78.9,

Need help in C++

I got stuck in question 2 and 3

1. Declare an array named temperatures and initialize it with the values 78.9, 32.6, 50.2 IN TWO WAYS (once using static initialization and once NOT using static initialization):

Non-Static Initialization:

Const int SIZE = 3;

int temperatures [SIZE];

temperatures[0]=78.9;

temperatures[1]=32.6;

temperatures[2]=50.2;

Static Initialization:

int temperatures [] = { 78.9, 32.6, 50.2 };

2. Write a for loop to print the contents of the temperatures array from question 1 to the console:

3. Write a function to print the contents of an array of doubles to the console. The function is named printArray. It takes in two parameters - one is an array of doubles and the other parameter is an integer for the size of the array. It prints out the contents of the array. It returns nothing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!