Hi,
I've made this map:
1 2 3
|
struct person{string name1; string adress; string phonenumber;} data;
map <string, person> phonebook;
|
I've search the internet for a code how to erase a specifik element from the map. What I found was this:
size_type erase( const key_type& key );
key_type& is tlfbog, right (phonebook&)? and
key is this string from the map?
So I've made a key for my map called 'Peter James' and it has name1 = "Peter James", adress = "HappyRoad 333" and phonenumber = "123456".
But now I would like to erase it? and I have to type it from the keyboard, how to do?
I had something in mind like:
1 2 3 4
|
string name2;
cout << "Type the name of the person you would like to erase: ";
getline(cin,str,'.');
size_type erase( const phonebook& str );
|
But it doesn't work! I get these errors;
error C2065: 'size_type' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'erase'
error C2143: syntax error : missing ')' before 'const'
error C2059: syntax error : ')'
error C3861: 'erase': identifier not found
Best regards
/Malik