This project implements a simple address book using a linked list data structure. The address book stores Person objects, which include Address details. The project consists of several C++ files organized into logical units for handling addresses, persons, and linked list operations.
-
Address.h / Address.cpp
- These files define and implement the
Addressclass, which includes information such as street, city, state, and zip code.
- These files define and implement the
-
Person.h / Person.cpp
- These files define and implement the
Personclass, which includes personal information such as name and anAddressobject.
- These files define and implement the
-
Node.h
- This file defines the
Nodeclass used in the linked list, representing each element in the list.
- This file defines the
-
LinkedList.h / LinkedList.cpp
- These files define and implement the
LinkedListclass, which manages a collection ofNodeobjects. EachNodecontains aPersonobject and a pointer to the next node.
- These files define and implement the
-
main.cpp
- This file contains the
mainfunction, which serves as the entry point of the program. It demonstrates the usage of theLinkedListto manage the address book.
- This file contains the
-
Attributes:
street:std::stringcity:std::stringstate:std::stringzip:std::string
-
Methods:
- Constructors
- Getters and setters for each attribute
print(): Displays the address information
-
Attributes:
name:std::stringaddress:Address
-
Methods:
- Constructors
- Getters and setters for each attribute
print(): Displays the person's information, including their address
-
Attributes:
person:Personnext:Node*(pointer to the next node)
-
Methods:
- Constructors
-
Attributes:
head:Node*(pointer to the first node in the list)
-
Methods:
add(Person p): Adds a person to the listremove(std::string name): Removes a person from the list by nameprint(): Displays all persons in the list
- C++ compiler (e.g., g++)
-
Compile the project using the following command:
g++ -o address_book main.cpp Address.cpp Person.cpp LinkedList.cpp
-
Run the executable:
./address_book
- The program demonstrates adding and removing persons from the address book and printing the list of all persons.
This project is licensed under the MIT License. See the LICENSE file for details.
- Instructor: Prof. Professor.Randall Hutton
- Course: COSC 350 - Advanced Algorithms and Data Structures, Columbia College of Missouri