#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int n =10;
int highestTemperature [n];
int lowestTemperature [n];
double humidity [n];
double totalHumidity = 0.0;
cout<<"Enter the details as prompted\n";
for(int i=0; i<n; i++){
cout<<"Enter the highest temperature for day "<<(i+1)<<endl;
cin>>highestTemperature [i];
cout<<"Enter the lowest temperature for day "<<(i+1)<<endl;
cin>>lowestTemperature [i];
cout<<"Enter the humidity for day "<<(i+1)<<endl;
cin>>humidity[i];
totalHumidity += humidity[i];
}
double average = totalHumidity / n;
cout<<"The total humidity is "<<totalHumidity<<" .The average humidity is "<<average<<endl;
int diurnalVariation [n];
for(int i=0; i<n; i++){
diurnalVariation [i] = highestTemperature [i] - lowestTemperature [i];
}
for(int i=0; i<n; i++){
cout<<diurnalVariation [i]<<endl;
}
cout<<"\t\t\t\tWeather Report\t\t\t"<<endl;
cout<<"Day\tHighest Temperature\t"<<"Lowest Temperature\t"<<"Diurnal Variation\t"<<"Humidity\t"<<"Humidity Strength\n";
for(int i = 0; i<n; i++){
cout<<(i +1)<<"\t\t"<<highestTemperature [i]<<"\t\t\t"<<lowestTemperature [i]<<"\t\t\t";
cout<<diurnalVariation [i]<<"\t\t"<<humidity[i]<<"\t\t\t";
if(humidity[i]>average){
cout<<"Greater"<<endl;
}
else{
cout<<"Less"<<endl;
}
}
cout << "\nMaximum Temperature = "
<< *max_element(highestTemperature , highestTemperature + n);
cout << "\nMinimum Temperature = "
<< *min_element(highestTemperature, highestTemperature + n);
cout<<"The overall humidity is\t"<<*max_element(humidity, humidity + n);
}
Comments
Leave a comment