Compare commits
No commits in common. "908691c5daa1dd572362dfd25a3ba5193ee77e57" and "dce65dcb84c94833bfdec4639b91788ed2a8a9ac" have entirely different histories.
908691c5da
...
dce65dcb84
@ -2,7 +2,6 @@
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -21,7 +20,6 @@ void PhoneBook::add_contact(Contact *new_contact)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
std::cout << std::endl << this->len << std::endl;
|
||||
if (this->len < 8)
|
||||
{
|
||||
this->contacts[this->len] = new_contact;
|
||||
@ -29,8 +27,7 @@ void PhoneBook::add_contact(Contact *new_contact)
|
||||
}
|
||||
else
|
||||
{
|
||||
delete this->contacts[0];
|
||||
for (i = this->len - 1; i > 0; i--) {
|
||||
for (i = this->len; i != 0; i--) {
|
||||
this->contacts[i] = this->contacts[i - 1];
|
||||
}
|
||||
this->contacts[0] = new_contact;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <bits/stdc++.h>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "../include/PhoneBook.hpp"
|
||||
@ -35,9 +34,10 @@ Contact* read_contact()
|
||||
return (NULL);
|
||||
|
||||
return (new Contact(first_name, last_name, nickname, phone_number, darkest_secret));
|
||||
|
||||
}
|
||||
|
||||
Contact* search(PhoneBook &phone_book)
|
||||
Contact* search(PhoneBook phone_book)
|
||||
{
|
||||
int index;
|
||||
std::string index_str;
|
||||
@ -60,6 +60,7 @@ int main()
|
||||
Contact* contact;
|
||||
PhoneBook phone_book;
|
||||
|
||||
phone_book = PhoneBook();
|
||||
while (true)
|
||||
{
|
||||
std::cout << "command: ";
|
||||
|
Loading…
Reference in New Issue
Block a user