#include <iostream>
//#include <cstring>
#include <queue>
#include "Date.h"
#include "Person.h"

using namespace std;

int fynd(string,int,int);

int main()
{
/*     Date d0(1969, 8, 15);
 *     cout << d0;
 *     Date *tL = new Date[100];
 *     //Date* tL;
 *     bool more1 = true;
 *     int i = 0;
 *     Date *tLstart = tL;
 *     while(more1 && i<100) {
 *         cout << "\nEnter a date (y-m-d) for the timeline: ";
 *         cin >> tL[i];
 *         cin.ignore(10,'\n');
 *         //cout << "\nEnter the diary entry for " << tL[i].weekday() << ", " << tL[i] << ": ";
 *         tL->enterDiary();
 *         ++tL; //++i;
 *         cout << "\nEnter '0' to stop or any other value to continue: ";
 *         cin >> more1;
 *         cin.ignore(10,'\n');
 *     }
 *     Date *di = tLstart; // initialize date iterator to 0 offset
 *     //cout << "\ndi->year() = " << di->year();
 *     while(di->year()>1702)
 *     {
 *         cout << *di << endl;
 *         di->showDiary();
 *         cout << endl;
 *         ++di;
 *     }
 */
/*     Person per1; //"Blow", "Joe",Date(2014-2-27));
 *     //cout << pp;
 *     cout << "\nHi, I'm " << per1.fname() << " " << per1.lname()
 *          << " and my number is " << per1.id() << endl;
 */
/*     tL[0] = d0;
 *     Person* pp = new Person[10];
 *     string first, last, idnumber;
 *     for(int i = 0; i < 2; ++i, ++pp)
 *     {
 *         cout << "\nWhat's your name? ";
 *         cin >> first;
 *         pp->set_fname(first);
 *         cin >> last;
 *         pp->set_lname(last);
 *         cout << "\nWhat's your number? ";
 *         cin >> idnumber;
 *         pp->set_id(idnumber);
 *     }
 *     pp -= 2;
 *     for(int i = 0; i < 2; ++i, ++pp)
 *     {
 *         cout << pp->fname() << " " << pp->lname() << " " << pp->id() << endl;
 *     }
 *     Date d1;
 *     for(;;)
 *     {
 *         cout << "\nEnter a date (y-m-d): ";
 *         cin >> d1;
 *         cout << "\nThat's a " << d1.weekday() << endl;
 *     }
 */
    //delete [] pp;
    //per1.read_timeLine();
    queue<Person> movieLine;
    char more;
    Person per1;
    string name;
    do {
        cout << "\nEnter the first name of the person in line: ";
        cin >> name;
        per1.set_fname(name);
        movieLine.push(per1);
        cout << "\nDo you want to enter another? (y)es or (n)o?";
        cin >> more;
    } while(tolower(more)=='y');
    cout << "\nHere are the people in line:";
    //queue<Person>::iterator
    //auto it = movieLine.begin();
    int n = movieLine.size();
    for(int i = 0; i < n; ++i) {
        cout << movieLine.front().fname() << endl;
        movieLine.pop();
    }
    fynd(movieLine, )
    return 0;
}

int fynd(queue<Person> q, int i, int j) {
    cout << "\nEnter a name for a person to search for in line: ";
    string name;
    cin >> name;
    cout << "\nEnter the limits of the range of indices: ";
    int i, j;
    for(int k = 0; k<i-1; ++k) q.pop();
    for(int k = i-1; i < j; ++k) {
        if(q.Person().fname() == name ) return k;
    }
    return j;
}
