a. write a program to process a collection of daily high temperatures. your prog
ID: 3626225 • Letter: A
Question
a. write a program to process a collection of daily high temperatures. your program should count and print 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 60). it should also display the category of each temperature. test your program on the following data:58 65 68 74 59 45 41 58 60 67 65 78 82 88 91
92 90 93 87 80 78 79 72 68 61 59
b. modify your program to display the average temperature (a real number) at the end of the run.
*notes:
Your program should prompt the user the following:
1. Enter 28 radings for temperature
2. Display the hottest days(high temperature 85 or higher).
3. Display Pleasant days(temperatue between 60-84).
4. Display number of cold days(high temperatue less than 60).
5. Finally display the average temperature.
- please I need the output screen (black screen for result)
- write a program in c languge.
thanks,
Explanation / Answer
please rate - thanks
part 2
#include<iostream>
using namespace std;
int main()
{int i=0,number,hot=0,cold=0,ok=0,sum=0;
cout<<"Enter 26 readings for temperature: ";
for(i=1;i<=26;i++)
{cout<<"Enter temperature "<<i<<": ";
cin>>number;
sum+=number;
cout<<"number ";
if(number>=85)
{hot++;
printf("hot ");
}
else if(number>=60)
{ok++;
printf("pleasant ");
}
else
{cold++;
printf("cold ");
}
}
cout<<" Number of: Hot days: "<<hot<<
" Pleasant days: "<<ok<<" Cold days: "<<cold<<endl;
cout<<"The average temperature is "<<sum/26.<<endl;
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.