Question: Guys I've been working on it for a week and I ' m going crazy.!!! Today is the last day of homework, can you help
Guys I've been working on it for a week and Im going crazy.!!!
Today is the last day of homework, can you help me C
My code;
#include
#include
using namespace std;
Function declaration
void menuint &input; Pass input variable by reference
int main
Variable declarations
int isLLcreated input LLsize IDsize Namesize GPAsize ;
int ID nullptr;
float GPA nullptr;
string Name nullptr;
Main loop for menudriven interaction
while true
Display menu and get user input
menuinput; Pass input variable by reference
Handle user input
if input && isLLcreated
Create linked list
cout "Enter size of linked list: ;
cin LLsize;
ID new intLLsize;
GPA new floatLLsize;
Name new stringLLsize;
isLLcreated ;
cout "Linked list is created.
;
else if input && isLLcreated
Linked list already created
cout "Linked list is already created.
;
else if input && isLLcreated
Add node to the linked list
if IDsize LLsize
cout "Please enter ID: ;
cin IDIDsize;
cout "Please enter GPA: ;
cin GPAGPAsize;
cin.ignore;
cout "Please enter Name: ;
getlinecin NameNamesize;
IDsize;
GPAsize;
Namesize;
cout "Node added successfully.
;
else
cout "Linked list is full. Cannot add more nodes.
;
else if input && isLLcreated
Delete node from the linked list not implemented
cout "Delete functionality not implemented yet.
;
else if input && isLLcreated
Display linked list not implemented
cout "Display functionality not implemented yet.
;
else if input Check for Exit option
Exit the program
cout "Program exit.
;
break; Exit the loop if Exit option is selected
else
Invalid command or linked list not created
cout "Invalid command or linked list not created.
;
Deallocate memory before exiting
delete ID;
delete GPA;
delete Name;
return ;
Function definition for displaying menu
void menuint &input Receive input variable by reference
cout "Enter command
Create
Add
Delete
Display
Modify
Purge entire list
Search for node
Exit
;
cin input;
Add a node node contents of your choice:
a When the List is empty
b In the beginning of the List
c In the end of the List
d Somewhere between the beginning and the end of the List.
e When the LL is not created
f when a duplicate record is found
The ADD algorithm is to determine where the new node is to be placed
in the List.
The user is not asked where the new node should be
inserted.
Delete anode:
a When the List is empty
b From the beginning of the List
c From the end of the List
d From somewhere between the beginning and the end of the List.
e When the LL is not created
f show what happens when an attempt is made to delete a node which
is not in the list
The DELTE algorithm is to determine where the targeted
node is placed in the List.
The user is not asked about the location of the targeted
node.
Search for a node and display its contents.
The Search is done based on a key field from the node ie a name, or
an ID
The Search algorithm is to locate the targeted node and to display it
The user is not asked about the location of the targeted
node.
Show what happens when and where the target is found and
when it is not found
Modify a node.
The user is to enter a key field from the node ie a name, or an ID
The Search algorithm is to search for the targeted node from the
beginning of the List.
Address what happens if an attempt is made to search for a record
before creating the LL
Display the node before and after modification.
Display the Entire Linked List.
The display function is to display the list from the front to end and
Address what happens if an attempt is made to search for a record
before creating the LL
purge the LL
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
