コード例 #1
0
ファイル: PD_Application.cpp プロジェクト: mcook18/HW02
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 = "";
	}
	
}
コード例 #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";
    }
}
コード例 #3
0
ファイル: PD_Application.cpp プロジェクト: bryanxiong/HW02
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 
	
}