67 172
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #7056 in C++ for Hanif Halmi

Question #7056
Write a program that will read daily temperature reading for the month of January 2012. Your program should contain the following functions:
(a) main() function contains instructions of reading input needed and print all the related information.
(b) NORMAL() function calculates the number of normal days (temperature between 60F and 84F)
(c) AVERAGE() function calculates the average temperature in January 2012.
(d) DAYS() function calculates
Expert's answer
Dear customer, please state definitely what does DAYS() function calculate.

#include <iostream>
using namespace std;

int i;
int temperature[32];

int NORMAL(){
int res=0;
for (i=1;i<=31;i++){
& if ((temperature[i]>=60) && (temperature[i]<=84)) res++;
}
return res;
}

float AVERAGE(){
float res=0;
for (i=1;i<=31;i++)
& res = res+temperature[i];
return (res/31);
}

void main(){
for (i=1;i<=31;i++){
& cout<<"Enter a day temperature on January "<<i<<": ";
& cin>>temperature[i];
}
cout<<"The number of normal days is "<<NORMAL()<<"\n";
cout<<"The average temperature is "<<AVERAGE()<<"\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions