Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdio.h> //to use the command rename
- #include <string>
- using namespace std;
- int main()
- {
- ifstream inFile;
- fstream file;
- int choice;
- double highest=-9999;
- double Year, Month, Day, Hour, Minute, Temperature, Relative_Humidity, Total_Precipitation, Wind_Speed, Wind_Direction;
- cout<<" Weather database 2.Temperature "<<endl;
- cout<<"Please enter your choice: ";
- cin>>choice;
- if(choice==2)
- {
- inFile.open ("Weather_database.txt" );
- if(!inFile) cout<<"Error encountered. Exit program. \n";
- else
- {
- while(!inFile.eof() )
- {
- inFile>>Year>>Month>>Day>>Hour>>Minute
- >>Temperature>>Relative_Humidity>>Total_Precipitation>>Wind_Speed>>Wind_Direction;
- if(Temperature>highest)
- {
- highest=Temperature;
- }
- }
- inFile.close();
- }
- cout<<"Highest temperature= "<<highest<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement