Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

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.

OpenStudy (anonymous):

eh? do you have your current attempt? I see decalrations, functions, and while and if loops...

OpenStudy (anonymous):

so how is it solved ???

OpenStudy (anonymous):

trying 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.

OpenStudy (anonymous):

int 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.

OpenStudy (anonymous):

note that the array simply has 2 values. since i<2. edit this to include 24 values.

OpenStudy (anonymous):

after 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.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!