Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.03 KB | None | 0 0
  1. // MAIN.CPP
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. #include <istream>
  6. #include <string.h>
  7. #include <string>
  8. #include "date.h"
  9. #include "VECTOR.h"
  10.  
  11. using namespace std;
  12.  
  13. Vector<std::string> SplitString(std::string source, std::string separator) {
  14.  
  15.     Vector<std::string> outValues;
  16.     int lastPos = 0;
  17.  
  18.     for (;;) {
  19.  
  20.         int pos = source.find(separator, lastPos);
  21.  
  22.         if (pos == std::string::npos) { break; }
  23.  
  24.         std::string element = source.substr(lastPos, pos - lastPos);
  25.  
  26.         outValues.push_back(element);
  27.  
  28.         lastPos = pos + 1;
  29.     }
  30.  
  31.     return outValues;
  32. }
  33.  
  34. struct wind_log_data {
  35.     string month;
  36.     int year;
  37.     float w_speed;
  38.     float a_a_temp;
  39.     float s_radi;
  40. };
  41.  
  42. int main()
  43. {
  44.     int m_choice = 0;
  45.     float avg_w_speed;
  46.     float avg_a_a_temp;
  47.     float total_s_radi;
  48.  
  49.     Vector<wind_log_data> windlog;
  50.  
  51.     ifstream windfile;
  52.     windfile.open("data.csv", ios::in);
  53.     if (!windfile) return -1;
  54.  
  55.     while (getline(windfile))
  56.     {
  57.         wind_log_data row;
  58.         windlog.push_back(row);
  59.     }
  60.  
  61.     cout << "1. The average wind speed and average ambient air temperature for a specified month and year. (print on screen only)" << '\n';
  62.     cout << "2. Average wind speed and average ambient air temperature for each month of a specified year. (print on screen only)" << '\n';
  63.     cout << "3. Total solar radiation in kWh/m2 for each month of a specified year. (print on screen only)" << '\n';
  64.     cout << "4. Average wind speed (km/h), average ambient air tempature and total solar radiation in kWh/m2 for each month of a specified year. (print to a file called \"WindTempSolar.csv\")" << '\n';
  65.     cout << "5. Exit the program." << '\n';
  66.  
  67.     cout << "Choose a menu:";
  68.  
  69.     while (m_choice != 5) {
  70.         cin >> m_choice;
  71.         if (m_choice == 1) {
  72.  
  73.         }
  74.         else if (m_choice == 2) {
  75.  
  76.         }
  77.         else if (m_choice == 3) {
  78.  
  79.         }
  80.         else if (m_choice == 4) {
  81.  
  82.         }
  83.         else if (m_choice == 5) {
  84.             break;
  85.         }
  86.         else {
  87.             cout << '\n';
  88.             cout << "That is not a valid menu option." << '\n';
  89.             cout << '\n';
  90.             cout << "Please choose a menu from 1 to 5: ";
  91.         }
  92.     }
  93.  
  94.   return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement