Well Perhaps I should've been more precise with my reuqest. Basically I'm supposed to anylize the daily maximum and minimum of Temperature, Pressure and Humidity from a file that a user chooses by typing the file name into a prompt after choosing it in a menu. I'm also supposed to find out the maximum daily wind speed as well.
Well Here's my code so far
///
///
///
///
///
/// Program: Weather data processing
/// Created by: Wesley Montgomery
/// This program anlizes weather data accessed from a file and finds the average of Temperature, Humidity, and other facts.
///
///
///
#include <fstream>
#include <iostream>
#include <string>
#include <cmath>
#include <stdlib.h>
#define MAX_SIZE 4589
using namespace std;
int main()
{
int pressure, temp, windspeed, windchill, dew, heatindx, humidity, rainfall, winddir, avgwindspeed, peakwindspeed, totalrainfall;
bool done; // exit flag
char selection; //Menu Selection
string file; // Name of datafile
ifstream weatherfile; //datafile stream
// Initialize exit flag
done = false;
while (!done)
{
// Output menu list
cout << "\n\n";
cout << "************************\n\n";
cout << " Weather Data Analysis: \n";
cout << " 1) Select Data File to be loaded\n";
cout << " 2) Daily Min/max of Temp,Pressure and humidity\n";
cout << " 3) Daily Max Wind Speed\n";
cout << " 4) Avg Pressure, Humidity, and Windspeed for rainy days\n";
cout << " 5) Total Daily Rainfall\n";
cout << " 6) Exit Program\n";
cout << "************************\n\n";
// Input data
cout << "Selection -> ";
cin >> selection;
cout << "\n\n";
// Process input
if (selection=='1')
{
cout << "Insert Data file:";
cin >> file;
weatherfile.open (file.c_str(), ios::in);
cout << "\n\n";
}
else if (selection=='2')
{
while (!weatherfile.eof())
{
}
}
else if (selection=='3')
{
while (!weatherfile.eof())
{
}
}
else if (selection=='4')
{
while (!weatherfile.eof())
{
if (rainfall > 0)
{
}
}
}
else if (selection=='5')
{
while (!weatherfile.eof())
{
}
}
else if (selection=='6')
{
cout << "Goodbye. Thank you for using my program.\n\n";
done = true; // flag for exit
}
else
{
cout << "** Invalid Selection. **\n\n";
}
} // end of while loop
return (0);
}
And here's an example of the file it's supposed to open.
DATE,HOUR,Temperature,Wind Chill,Dew Point,Heat Index,Relative Humidity,Pressure,RainFall,Wind Dir,Wind Speed,Avg. Wind Spd.,Peak Wind Spd.
07/01/1999,11:30,53,53,51,53,92,1014,0.00,180,0,0,0
07/01/1999,11:40,54,54,50,54,87,1014,0.03,225,0,1,5
07/01/1999,11:50,56,54,50,56,81,1015,0.03,180,5,1,5
07/01/1999,12:00,57,57,52,57,83,1014,0.03,270,0,0,2
07/01/1999,12:10,57,52,49,57,76,1015,0.04,292,7,4,7
07/01/1999,12:20,58,58,53,58,83,1015,0.06,315,3,2,4
07/01/1999,12:30,58,58,53,58,83,1015,0.06,337,0,2,5
07/01/1999,12:40,59,59,52,59,77,1015,0.08,270,2,3,4
07/01/1999,12:50,60,60,53,60,78,1015,0.09,360,0,1,4
07/01/1999,13:00,60,60,53,60,78,1015,0.12,360,0,1,4
07/01/1999,13:10,61,54,48,61,62,1014,0.12,247,10,4,10
07/01/1999,13:20,62,62,47,62,59,1015,0.12,180,3,3,7
07/01/1999,13:30,62,62,49,62,62,1015,0.12,247,1,3,7
07/01/1999,13:40,62,62,48,62,60,1015,0.12,225,4,3,6
07/01/1999,13:50,64,64,49,64,58,1014,0.14,180,4,1,5
07/01/1999,14:00,65,65,46,62,51,1015,0.14,202,4,5,9
And Well I'm also getting errors with this code of mine that mostly say 'unreferenced local variable even though they are there in the int list at the top. I tried find some solutions in my book, but it didn't help that much. I also tried to find information on the internet but I didn't have any luck there as well.
So could someone help me with this little problem?