/**
PPP4-19: Write a program where you first enter a set of name-and-value
pairs, such as Joe 17 and Barbara 22. For each pair, add the name to a
vector called names and the number to a vector called scores (in
corresponding positions, so that if names[7]=="Joe" then scores[7]==17).
Terminate input with NoName 0. Check that each name is unique and
terminate with an error message if a name is entered twice. Write out all
the (name,score) pairs, one per line.
PPP6-4:Define a class Name_value that holds a string and a value.
Rework exercise 19 in Chapter 4 to use a vector<Name_value>
instead of two vectors.*/

#include "std_lib_facilities.h"

class Name_value {
public:
    string name;
    int value;
    Name_value(string n, int v) : name(n), value(v) {}
};

int main() {
    vector<Name_value> nvv;
    ///Name_value nv;
    string temps;
    int tempint;
    Name_value nv(temps, tempint);
    while(temps!="NoName" && tempint!=0)
    {
        cout << "\nInput a name and a number: ";
        cin >> temps >> tempint;
        Name_value nv(temps, tempint);
        nvv.push_back(nv);
    }
    cout << "\nYou entered: \n";
    for(int i = 0; i < nvv.size(); ++i)
        cout << '(' << nvv[i].name << ", " << nvv[i].value << ')' << endl;
}
