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.
12 messages · Page 1 of 1 (latest)
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.
Youre not incrementing count2 in second while loop
ok thank you SO MUCH for this completely missed it. although there is still one issue, its printing and all correctly but its placed it one index after the one specified.
could u help with that?
for instnace if i enter "75" at the 2nd index, it inserts it at the 3rd
@lime tiger Has your question been resolved? If so, type !solved :)
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
yeah i tried the latter, but it didnt work still.
and i dont think i can try pos = 1 because pos is entered by the user
**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
enteredcount2 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