my_borrow_return.h file

Classes

struct borrower
Structure representing borrower information.
struct node
This structure is used for linked list operation.

Functions

auto operator<<(std::ostream& out, const borrower& x) -> std::ostream&
Operator Overloading "<<"
auto makenode(borrower x) -> node*
Make a node
void add_to_node_first(node*& head, borrower x)
Add into first.
void print_borrower(node* head)
Print linked list.
auto count_node(node* head) -> int
Count linked list.
void add_to_node_last(node*& head, borrower x)
Add into last.
void add_to_node_middle(node*& head, borrower x)
Add into middle.
void delete_first(node*& head)
Delete the first node.
void delete_middle(node*& head)
Delete the middle node.
void delete_last(node*& head)
Delete the last node.
auto addDays(const std::string& date_str, int days_to_add) -> std::string
Add day.
void borrow(node*& borrow_list)
Borrow devices.
void return_device(node*& borrow_list)
Return devices.

Function documentation

std::ostream& operator<<(std::ostream& out, const borrower& x)

Operator Overloading "<<"

Dev can print the struct's information by using "cout <<"

node* makenode(borrower x)

Make a node

Parameters
x parameter type struct borrower
Returns node*

Init a node by dynamic memory allocation for data x

void add_to_node_first(node*& head, borrower x)

Add into first.

Parameters
head
x parameter type struct borrower, default linked list

Add a node to the beggining of the linked list

void print_borrower(node* head)

Print linked list.

Iterate through linked list and print every single node

int count_node(node* head)

Count linked list.

Returns Length of linked list

Iterate through linked list and return length of linked list

void add_to_node_last(node*& head, borrower x)

Add into last.

Parameters
head
x parameter type struct borrower, default linked list

Add a node to the last of the linked list

void add_to_node_middle(node*& head, borrower x)

Add into middle.

Parameters
head
x parameter type struct borrower, default linked list

Add a node to the middle of the linked list

void delete_first(node*& head)

Delete the first node.

Delete the first node of the linked list

void delete_middle(node*& head)

Delete the middle node.

Delete the middle node of the linked list

void delete_last(node*& head)

Delete the last node.

Delete the last node of the linked list

std::string addDays(const std::string& date_str, int days_to_add)

Add day.

Returns string

Add day from a beginning day in format xx/xx/xxxx

void borrow(node*& borrow_list)

Borrow devices.

Allow user to enter information to rent a device and add their info to the last of the linked list

void return_device(node*& borrow_list)

Return devices.

Allow user to enter information to rent a device and delete their info as the node in the linked list