CPP00 1.0
|
Defines the PhoneBook class. [詳解]
#include <PhoneBook.hpp>
公開メンバ関数 | |
PhoneBook () | |
Default constructor for the PhoneBook class. | |
void | addContact () |
Adds a new contact to the phone book. | |
void | searchContact () const |
Searches for and displays contact information by index | |
std::string | getInputLine () const |
Reads a line of text from standard input. | |
Defines the PhoneBook class.
The PhoneBook class manages a collection of contacts, allowing users to add, search for, and display contact information. It has a fixed capacity of 8 contacts.
PhoneBook.hpp の 41 行目に定義があります。
PhoneBook::PhoneBook | ( | ) |
Default constructor for the PhoneBook class.
Initializes the contact count to zero.
PhoneBook.cpp の 25 行目に定義があります。
void PhoneBook::addContact | ( | ) |
Adds a new contact to the phone book.
Prompts the user for contact details and adds them to the stored contacts. If the phone book is full (8 contacts), it shifts the existing contacts to make space for the new one, effectively overwriting the oldest contact. All fields (first name, last name, nickname, phone number, darkest secret) are mandatory.
PhoneBookAddContact.cpp の 24 行目に定義があります。
std::string PhoneBook::getInputLine | ( | ) | const |
Reads a line of text from standard input.
Reads characters from standard input until a newline character is encountered or the end-of-file (EOF) is reached. If EOF is encountered, the program exits.
PhoneBook.cpp の 35 行目に定義があります。
void PhoneBook::searchContact | ( | ) | const |
Searches for and displays contact information by index
Prompts the user for a contact index and displays the corresponding details if a valid index is provided.
PhoneBookSearchContact.cpp の 107 行目に定義があります。