A community for students.
Here's the question you clicked on:
 0 viewing
fatemah
 2 years ago
Write a C++ program to enter 24 readings of tempe
rature (each reading is between

5
and 45), compute and print out the average temperature, maximum temperature and
minimum temperature of the day. Enforce the necessary validation on the user input.
Use proper format for the output.
fatemah
 2 years ago
Write a C++ program to enter 24 readings of tempe rature (each reading is between  5 and 45), compute and print out the average temperature, maximum temperature and minimum temperature of the day. Enforce the necessary validation on the user input. Use proper format for the output.

This Question is Open

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.0eh? do you have your current attempt? I see decalrations, functions, and while and if loops...

fatemah
 2 years ago
Best ResponseYou've already chosen the best response.0so how is it solved ???

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.0trying to write one now. lol i'm using asking user input to be put into arrays. though i would rather write in python. lol seems like it's working.

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.0int main() { int a; int i=0; int temp[24]; while (i<2) { cin>>a; if (a<45) { temp[i]=a; i++; } else { cin.clear(); while (cin.get() != '\n') ; cin>>a; } } } this is the main function where iteration is used to place the values.

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.0note that the array simply has 2 values. since i<2. edit this to include 24 values.

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.0after putting them in an array, add them together with a while or for function before dividing them by their total number. for max, just write an auto update function that will update when there is a number that is larger than before.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.