Answer:
The program to this question can be described as follows:
Program:
#include <iostream> //defining header file
using namespace std;
int main() //defining main method
{
int hourly_temperature[] ={90,92,94,95}; //defining integer array
int len= sizeof(hourly_temperature)/ sizeof(hourly_temperature[0]); //calculate length of array
for(int i=0;i<len-1;i++) //loop to print its value
{
cout<<hourly_temperature[i]<<"->"; //print value
}
cout<<hourly_temperature[len-1]; //print last element value
return 0;
}
Output:
90->92->94->95
Step-by-step explanation:
In the given code an integer array "hourly_temperature" is declared, which holds some value, that is "90,92,94,95", in the next step, an integer variable "len" variable is declared, that holds array size.
- Then a for loop is declare that uses the "i" variable, which starts from 0 and ends when the "i" value is less than "len-1".
- Inside the loop array values are printed with the "->" sign, and outside the loop, the last variable value is printed.