Problem 3b50 points Write a program to process a collection

Problem 3b-50 points Write a program to process a collection of daily high temperatures. Your program should count the number of hot days (high temperature 85 or higher, the number of pleasant days (high temperature 60 84), and the number of cold days (high temperatures less than 600. Test your program on the following data: 55 62 68 74 59 45 41 58 60 67 65 78 82 88 91 92 90 93 87 80 78 79 72 68 61 59-99 Note that the last value (-99) is used as a sentinel value and should not be counted as a cold day On the next page is a screen shot of a working solution with the while loop missing. Starter code for Program 3b: your name Prog 3b sinclude Khidef.h common defines and nacros derivative-specific definitions #include \"derivative h void main (void) unsigned short hot 0, pleasant 0, cold 0. i 0: unsigned short temps[] 55. 62. 68 74. 59, 45. 41. 58, 60, 67, 65, 78. 82. 88, 91. 92 90, 93 87 80, 78, 79. 72, 68. 61. 59, 99 write a vhile loop to count the days in each category while (1)

Solution

Hi, friend, I have written the while loop, please add this while loop at required place in your program.

Please let me know in case of any issue.

while(1){

   // EXIT condition
   if(temps[i] == -99)
       break; // stop loop

   if(temps[i] >= 85)
       hot = hot + 1;
   else if(temps[i]>=60)
       pleasant = pleasant + 1;
   else // less than 60
       cold = cold + 1;

   i = i+1;
}

 Problem 3b-50 points Write a program to process a collection of daily high temperatures. Your program should count the number of hot days (high temperature 85

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site