Everything runs fine, except the Lowest Temperature and HIghest Temperature do not output correctly.
Also any suggestions on how I could implement vectors,
Any help would be greatly appreciated.
Thanks.
#include<iostream>
using namespace std;
int main()
{
int i(0);
double Calc(double fahren);
double Total(0),Celsius[5],Fahrenheit[5];
double CelciusLowTemp(0), FahrenheitLowTemp(0), CelciusHighTemp(0), FahrenheitHighTemp(0);
double Mean_Celcius, Mean_Fahrenheit;
cout<< "Enter reported temperatures..."<<"\n"<< "\n";
for(i=0;i<5;i++) //Loops
{
cout<<"Weather Station "<<i<<" = ";// Takes input for Reported Temperatures...
cin>>Fahrenheit[i];
if (FahrenheitLowTemp < 0.1) //Conditionals
FahrenheitLowTemp = Fahrenheit[i];
else (FahrenheitLowTemp > Fahrenheit[i]);
FahrenheitLowTemp = Fahrenheit[i];
if (FahrenheitHighTemp < 0.1)
FahrenheitHighTemp = Fahrenheit[i];
else (FahrenheitHighTemp < Fahrenheit[i]);
FahrenheitHighTemp = Fahrenheit[i];
Celsius[i] = Calc(Fahrenheit[i]);
Total+=Fahrenheit[i];
}
CelciusLowTemp = Calc(FahrenheitLowTemp);
CelciusHighTemp = Calc(FahrenheitHighTemp);
Mean_Fahrenheit = Total/5.0;
Mean_Celcius = Calc(Mean_Fahrenheit);
cout<<" ========NGS Temperature Data Report======== "<<endl;
cout<<" Fahrenheit Celsius "<<endl;
cout<<" --------------------------------------------------------------"<<endl;
cout<<"Lowest Temperature: "<<FahrenheitLowTemp<<" "<<CelciusLowTemp<<endl;
cout<<" --------------------------------------------------------------"<<endl;
cout<<"Highest Temperature: "<<FahrenheitHighTemp<<" "<<CelciusHighTemp<<endl;
cout<<" --------------------------------------------------------------"<<endl;
cout<<"Mean Temperature: "<< Mean_Fahrenheit<<" "<<Mean_Celcius<<endl;
cout<<" --------------------------------------------------------------"<<endl;
cout<<"Raw Data..."<<endl;
cout<<"\n";
for(i=0;i<5;i++) {
cout<<"WeatherStation "<<i<<": "<<Fahrenheit[i]<<" "<<Celsius[i]<<endl;
}
cout<<" --------------------------------------------------------------"<<endl;
cout<<" =============End Temperature Data Report============="<<endl;
}
double Calc(double fah)
{
double cel;
cel = (5 *(fah - 32))/9.0;
return cel;
}