source/my_borrow_return.cpp file

Functions

auto operator<<(ostream& out, const borrower& x) -> ostream&
auto operator>>(istream& in, node& x) -> istream&
auto operator<<(ostream& out, const node& x) -> ostream&
void borrower_standardize(borrower& x)
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, int k)
void delete_first(node*& head)
Delete the first node.
void delete_middle(node*& head, int k)
void delete_last(node*& head)
Delete the last node.
auto addDays(const string& date_str, int days_to_add) -> string
void borrow(node*& borrow_list)
Borrow devices.
void return_device(node*& borrow_list)
Return devices.

Function documentation

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 delete_first(node*& head)

Delete the first node.

Delete the first node of the linked list

void delete_last(node*& head)

Delete the last node.

Delete the last node of the linked list

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