Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void PhoneBook::add(Entry newEntry)
- {
- if(entries.size() == 0)
- {
- entries.push_back(newEntry);
- }
- else
- {
- for(int i = 0; i<entries.size() ; i++)
- {
- string str1 = entries[i].getName();
- string str2 = newEntry.getName();
- if(strcmp(str1.c_str(),str2.c_str()) == 0);
- if(strcmp(str1.c_str(),str2.c_str()) > 0)
- {
- entries.insert(entries.begin()+i,newEntry);
- }
- if(strcmp(str1.c_str(),str2.c_str()) < 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement