#Linked list menu driven program

12 messages · Page 1 of 1 (latest)

lusty duneBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

lime tiger
#

please ping on reply.

#

if u need the full code i can send that too

upper ridge
#

Youre not incrementing count2 in second while loop

lime tiger
#

could u help with that?

#

for instnace if i enter "75" at the 2nd index, it inserts it at the 3rd

lusty duneBOT
#

@lime tiger Has your question been resolved? If so, type !solved :)

upper ridge
#

Its because you have in the condition count2 <= pos-1 while pos starts from 0, change the pos initial to 1, or change the condition to count2 < pos - 1

lime tiger
#

**Linked list looks like this at first : ** 50 20 70

Menu:
1.Insert Beginning
2.Insert End
3.Insert Position
4.Delete Beginning
5.Delete End
6.Delete Position
7.Search
8.Display
9. Exit
Enter your choice: 3
Enter number you want to insert: 100
Enter the position you want to insert it at: 0
count is currently 0
count = 2
entered

count2 is 0

pos-1 is -1
Successfully inserted at the given position.

Menu:
1.Insert Beginning
2.Insert End
3.Insert Position
4.Delete Beginning
5.Delete End
6.Delete Position
7.Search
8.Display
9. Exit
Enter your choice: 8
**linked list looks like this at last : **50 100 20 70

#

idk if that'll help