Linked list has been sorted alphabetically in the following program.
struct pen{
char* color;
Int qty;
pen* link;
}
Q1. Using the above structure you are required to manage the linked list considering the
following rules.
Pen should be stored in alphabetical order.
* If you have two pens of color red and green, your linked list will be as follows:
head
* If you have 5 pens, Aqua, Green, Blue, Red and yellow, your linked list will be:
head
● Your program should display the menu:
Select your choice
1. Add Pen
2. Sell Pen
3. Display Stock
//------------------------------------------------------------------------------------------
Solution:
struct pen{
char* color;
Int qty;
pen* link;
}
Q1. Using the above structure you are required to manage the linked list considering the
following rules.
Pen should be stored in alphabetical order.
* If you have two pens of color red and green, your linked list will be as follows:
head
* If you have 5 pens, Aqua, Green, Blue, Red and yellow, your linked list will be:
head
● Your program should display the menu:
Select your choice
1. Add Pen
2. Sell Pen
3. Display Stock
//------------------------------------------------------------------------------------------
Solution: