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
Address
class, 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
Person
class, which includes personal information such as name and anAddress
object.
- These files define and implement the
-
Node.h
- This file defines the
Node
class 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
LinkedList
class, which manages a collection ofNode
objects. EachNode
contains aPerson
object and a pointer to the next node.
- These files define and implement the
-
main.cpp
- This file contains the
main
function, which serves as the entry point of the program. It demonstrates the usage of theLinkedList
to manage the address book.
- This file contains the
-
Attributes:
street
:std::string
city
:std::string
state
:std::string
zip
:std::string
-
Methods:
- Constructors
- Getters and setters for each attribute
print()
: Displays the address information
-
Attributes:
name
:std::string
address
:Address
-
Methods:
- Constructors
- Getters and setters for each attribute
print()
: Displays the person's information, including their address
-
Attributes:
person
:Person
next
: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