CPP00 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
main.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* main.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/03/19 21:20:03 by kamitsui #+# #+# */
9/* Updated: 2025/04/13 01:32:29 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "PhoneBook.hpp"
14
21int main(void) {
22 PhoneBook phoneBook;
23 std::string command;
24
25 while (true) {
26 std::cout << "Enter command (ADD, SEARCH, EXIT): ";
27 command = phoneBook.getInputLine();
28
29 if (command == "ADD")
30 phoneBook.addContact();
31 else if (command == "SEARCH")
32 phoneBook.searchContact();
33 else if (command == "EXIT")
34 break;
35 else
36 std::cerr << "Invalid input." << std::endl;
37 }
38 return (0);
39}
PhoneBook Class
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
ostream cerr
ostream cout
Defines the PhoneBook class.
Definition PhoneBook.hpp:41
std::string getInputLine() const
Reads a line of text from standard input.
Definition PhoneBook.cpp:35
void searchContact() const
Searches for and displays contact information by index
void addContact()
Adds a new contact to the phone book.
int main(void)
Main entry point of the Awesome Phone Book application.
Definition main.cpp:21