Ejemplo n.º 1
0
void do_remove_entry(Phone_Directory& the_directory) // Madeline did this exercise.
{
	string name;
	cout << "Enter name: ";
	getline(cin, name);
	string number = the_directory.lookup_entry(name);
	if (number != ""){
		number = "";
		name = "";
	}
	
}
Ejemplo n.º 2
0
void do_lookup_entry(Phone_Directory& the_directory)
{
    string name;
    cout << "Enter name: ";
    getline(cin, name);
    string number = the_directory.lookup_entry(name);
    if (number != "") {
        cout << "The number for " << name << " is " << number << "\n";
    }
    else {
        cout << name << " is not in the directory\n";
    }
}
Ejemplo n.º 3
0
void do_remove_entry(Phone_Directory& the_directory) // Exercise 1.8: please complete the function do_remove_entry - Ed/Kent
{
	string name;
	cout << "Enter name: ";
	getline(cin, name);
	string number = the_directory.lookup_entry(name);
	if (number != ""){ // If the name is found in the directory
		the_directory.remove_entry(name);// Call the remove_entry function to remove the name
		cout << name << " has been removed from the directory\n"; // Tell the user the entry has been deleted
	}
	else
		cout << name << " is not in the directory\n";// If the number is not found, tell the user
	// Complete the rest of this function 
	
}