コード例 #1
0
ファイル: FriendsBook.cpp プロジェクト: cwaffles/cmpt225
void modify(MyADT* theMembers) {    
    string newString = "";
	string theName = "";
	
    
    // Create a new member profile
	cout << "Please, enter the name of the member you are looking for: ";
	// Remove all leading whitespace -> ws	
	getline(cin >> ws, theName);
	Profile theMember(theName);
	
	// Add new member profile to list
	Profile * target = theMembers->search(theMember);

    if ( target != NULL ) {

		cout << "Modifying member : " << target->getName() << endl;
		cout << "Please, enter the new image for this member: ";
		// Remove all leading whitespace -> ws	
		getline(cin >> ws, newString);
		if ( !newString.empty() ) target->setImage(newString);
		cout << "Please, enter the new status of this member: ";
		// Remove all leading whitespace -> ws	
		getline(cin >> ws, newString);
		if ( !newString.empty() ) target->setStatus(newString);
				
		cout << "Please, enter the friend name to be inserted: ";
		// Remove all leading whitespace -> ws	
		getline(cin >> ws, newString);
		if ( !newString.empty() ) target->addFriend(newString);
	
		// Report to user
		cout << "Status of member : " << target->getName() << " has been successfully modified in FriendsBook." << endl;
	} else