#include <iostream>
using namespace std;
#include "menu.h"

void get_index(people & p, unsigned int & a, string msg="") {
    cout << msg;
    cin >> a;
    if(a >= p.size()) {
        throw string("Not in range!!");
    }
}

void get_two_indices(people & p, unsigned int & a, unsigned int & b) {
    if(p.size() < 2) {
        throw string("Not enough people to perform this operation.");
    }
    get_index(p, a, "enter first index: ");
    get_index(p, b, "enter second index: ");
    if(a == b) {
        throw string("indices need to be different");
    }
}

ostream & operator<<(ostream & os, const menu & m) {
    for(auto i: menu_items) {
        os << "  " << i << endl;
    }
    os << "your selection: ";
    return os;
}
