Ok I will point you to some things which I have seen...
First in the read_name() function,you have to terminate the loop after a while,or else the program WILL GET STUCK THERE.Yes ,I dont wanna provoke you,but thats true.
Heres a few lines which Ive written,
1 2 3 4 5 6 7 8 9 10 11 12 13
|
void Name_pairs::read_names(){
string temp;
char c='y';
while (c=='y'||c=='Y')
{
cin>>temp;
name.push_back(temp);
cout<<"Do you wanna add more?"<<endl;
cin>>c;
if(c=='n'||c=='N')
break;
}
|
Here the while loop will go on for one turn,and when the user gives a 'N' to char c,the loop checks for only 'y' and so the loop terminates.This will give a better result than asking for names forever,as the program will not do anything else but just that.
Hope you get it.And try to learn the basics of C++ first,like loops,if-else,switch.
After you gain a knowledge of that stuff,this type of things will be a cakewalk.
Hope you like it.(^_^)!!!!