Write a flowchart and program that does the following: Asks the user for the average temperature in each of the last 12 months After the user has entered the temperatures, the program should display them Uses a "for" loop to ask for the data, and use another "for" loop to display the data Stores the data in an array called "temperature"

Respuesta :

Answer:

Written in C++

#include<iostream>

using namespace std;

int main(){

float temperature[12];

for(int i =0; i<12;i++){

 cout<<"Temperature "<<1 + i<<": ";

 cin>>temperature[i];

}

for(int i =0; i<12;i++){

 cout<<"Temperature "<<1 + i<<": "<<temperature[i]<<endl;

}

return 0;

}

Explanation:

This line declares temperature as an array of 12 elements

float temperature[12];

The following loop prompts user for (and gets) input of temperature in the last 12 months

for(int i =0; i<12;i++){

 cout<<"Temperature "<<1 + i<<": ";

 cin>>temperature[i];

}

The following loop prints the input data

for(int i =0; i<12;i++){

 cout<<"Temperature "<<1 + i<<": "<<temperature[i]<<endl;

}

See Attachment for flowchart

Ver imagen MrRoyal