Leave number out of SEARCH, add SEARCH header trunk
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 24 Oct 2024 11:32:29 +0000 (13:32 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 24 Oct 2024 11:32:29 +0000 (13:32 +0200)
ex01/contact.cpp
ex01/phone_book.cpp

index a4f308f52ff036b165a609786181da0ec7304207..d5bca306c1272dec93dbb4e6ca8b1f2a5a45c2d6 100644 (file)
@@ -40,7 +40,6 @@ void  Contact::short_print(size_t index)
        print_field(m_first_name);
        print_field(m_last_name);
        print_field(m_nickname);
-       print_field(m_number);
        std::cout << '\n';
 }
 
index 38bca8d8cfded70449564f9daac13c7f8b22bfda..c102e2f7907f79b1672d092459f06810fe06c4ef 100644 (file)
@@ -2,6 +2,7 @@
 #include <iostream>
 #include <cstdlib>
 #include <string>
+#include <iomanip>
 
 PhoneBook::PhoneBook(void):
        m_size(0), m_last_added(7)
@@ -76,6 +77,10 @@ void PhoneBook::search(void)
                std::cout << "There are no contacts to be shown yet.\n";
                return ;
        }
+       std::cout << '|' << std::setw(10) << "Index" << "|";
+       std::cout << std::setw(10) << "First name" << "|";
+       std::cout << std::setw(10) << "Last name" << "|";
+       std::cout << std::setw(10) << "Nickname" << "|\n";
        for (size_t i = m_size; i > 0; --i)
                m_contacts[(i + m_last_added) % m_size].short_print(m_size - i + 1);
        while (true)