Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h> //to use the command rename
  4. #include <string>
  5. using namespace std;
  6. int main()
  7. {
  8. ifstream inFile;
  9.  
  10. fstream file;
  11. int choice;
  12.  
  13. double highest=-9999;
  14.  
  15. double Year, Month, Day, Hour, Minute, Temperature, Relative_Humidity, Total_Precipitation, Wind_Speed, Wind_Direction;
  16.  
  17. cout<<" Weather database 2.Temperature "<<endl;
  18. cout<<"Please enter your choice: ";
  19. cin>>choice;
  20.  
  21. if(choice==2)
  22. {
  23. inFile.open ("Weather_database.txt" );
  24. if(!inFile) cout<<"Error encountered. Exit program. \n";
  25. else
  26. {
  27. while(!inFile.eof() )
  28. {
  29. inFile>>Year>>Month>>Day>>Hour>>Minute
  30. >>Temperature>>Relative_Humidity>>Total_Precipitation>>Wind_Speed>>Wind_Direction;
  31.  
  32. if(Temperature>highest)
  33. {
  34. highest=Temperature;
  35. }
  36. }
  37. inFile.close();
  38.  
  39. }
  40. cout<<"Highest temperature= "<<highest<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement