#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<string>
#include<vector>


using namespace std;
struct DATE{
    int day;
    int month;
    int year;


   };
struct onDutyRecords{
    string name;
    double sunshine;
    double rainfall;
    double midTemp;
    DATE date;

             };
onDutyRecords person;

int ShowMenu(void);
void ListDaysOnDutyOfMet(vector <onDutyRecords> &);
void ListAllTheWetDays(vector <onDutyRecords> &);
void ListDaysOnDutyOfMet(vector <onDutyRecords> &);
void ListAllTheSunnyDays(vector <onDutyRecords> &);
void ListAverageOfTwoDays(vector <onDutyRecords> &);
void ListHotestDayByMiddayTemp(vector <onDutyRecords> &);
void ListDaysWithShortestSunshine(vector <onDutyRecords> &);
void Exit(void);
bool quitFlag = false;






int _tmain(int argc, _TCHAR* argv[])
{
    vector <onDutyRecords> records;

    ifstream infile("Report.txt");
    //what next on this line to extract file into vector?
    // so i could create functions below
    //what is wrong now with switch parametrs?
    int option;
    do
    { 
        option = ShowMenu();
        switch (option)
        {
        case 0:
            ListDaysOnDutyOfMet();
            break;
        case 1:
            ListAllTheWetDays();
            break;

        case 2:
            ListAllTheSunnyDays();
            break;
        case 3:
            ListAverageOfTwoDays();
            break;
        case 4:
            ListHotestDayByMiddayTemp();
            break;
        case 5:
            ListDaysWithShortestSunshine();
            break;

        case 6:
            Exit();
            break;

        default:
            cout << "invalid option\n";
        }
    } while (!quitFlag);
    return 0;
}


int ShowMenu(void)
    {
        int option;
        cout << "\n\n\n";
        cout << "\t0. Do Days On Duty Of Meteorologist\n";
        cout << "\t1. Display All The Wet Days\n";
        cout << "\t2. All The Sunny Days\n";
        cout << "\t3. Average Of Two Days\n";
        cout << "\t4. Hotest Day By Midday Temp\n";
        cout << "\t5.\tDays With Shortest Sunshine\n";
        cout << "\t6. Exit\n";
        cout << "\t\tEnter option : ";
        cin >> option;
        cout << endl << endl;
        return option;
    }



void ListDaysOnDutyOfMet(vector <onDutyRecords> &dOnDuty)
{
    cout << "Not impl";

}

void ListAllTheWetDays(vector <onDutyRecords> &dOnDuty)
{
    cout << "Not impl";
}

void ListAllTheSunnyDays(vector <onDutyRecords> &dOnDuty)
{
    cout << "Not impl";

}
void ListAverageOfTwoDays(vector <onDutyRecords> &dOnDuty)
{
    cout << "Not impl";
}
void ListHotestDayByMiddayTemp(vector <onDutyRecords> &dOnDuty)
{
    cout << "Not impl";
}

void ListDaysWithShortestSunshine(vector <onDutyRecords> &dOnDuty)
{

    cout << "Not impl";
}
void Exit(void)
{
    cout << "Not impl";

}

The OPs questions are in the comments in the code.

@OP:
How you would populate the vector of records would depend entirely on how the data has been stored in the input file. You need to read the data from the file and convert that to records that you can store in the vector.
But without knowing the exact format of the data in the input file, nobody can tell you exactly how to do it. It will be down to you to work out that part.

I recommend having a go at this yourself. If you have any problems, please post an updated version of your code, with a description of the problems you are having and an sample of the data in the input file. Not the whole file BTW, just a sample of maybe two or three records, exactly as they appear in the file and somebody here will help you out!

In answer to your second question RE: your switch statement; You have defined a set of functions which all take a reference to a vector of records as a parameter. But in your calls to the functions in your switch statement, you aren't passing any parameters at all. So your compiler is giving you a whole bunch of error messages!

So you need to call the functions like this:
ListAllTheWetDays(records);

Edited 2 Years Ago by JasonHippy

This question has already been answered. Start a new discussion instead.