Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MAIN.CPP
- #include <iostream>
- #include <fstream>
- #include <istream>
- #include <string.h>
- #include <string>
- #include "date.h"
- #include "VECTOR.h"
- using namespace std;
- Vector<std::string> SplitString(std::string source, std::string separator) {
- Vector<std::string> outValues;
- int lastPos = 0;
- for (;;) {
- int pos = source.find(separator, lastPos);
- if (pos == std::string::npos) { break; }
- std::string element = source.substr(lastPos, pos - lastPos);
- outValues.push_back(element);
- lastPos = pos + 1;
- }
- return outValues;
- }
- struct wind_log_data {
- string month;
- int year;
- float w_speed;
- float a_a_temp;
- float s_radi;
- };
- int main()
- {
- int m_choice = 0;
- float avg_w_speed;
- float avg_a_a_temp;
- float total_s_radi;
- Vector<wind_log_data> windlog;
- ifstream windfile;
- windfile.open("data.csv", ios::in);
- if (!windfile) return -1;
- while (getline(windfile))
- {
- wind_log_data row;
- windlog.push_back(row);
- }
- cout << "1. The average wind speed and average ambient air temperature for a specified month and year. (print on screen only)" << '\n';
- cout << "2. Average wind speed and average ambient air temperature for each month of a specified year. (print on screen only)" << '\n';
- cout << "3. Total solar radiation in kWh/m2 for each month of a specified year. (print on screen only)" << '\n';
- 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';
- cout << "5. Exit the program." << '\n';
- cout << "Choose a menu:";
- while (m_choice != 5) {
- cin >> m_choice;
- if (m_choice == 1) {
- }
- else if (m_choice == 2) {
- }
- else if (m_choice == 3) {
- }
- else if (m_choice == 4) {
- }
- else if (m_choice == 5) {
- break;
- }
- else {
- cout << '\n';
- cout << "That is not a valid menu option." << '\n';
- cout << '\n';
- cout << "Please choose a menu from 1 to 5: ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement