+ 2

Why does the program end when i try to delete a record thats not in the list [SOLVED]

Hey guys, So the delete part of this program runs pefectly with records that are in the list. When i try deleting a record thats not in the list, rather than printing an error message and going back to the menu, the program simply ends. Please advise me on what ive done wrong. Thanks https://code.sololearn.com/cpQ89d8obQ7e/?ref=app

22nd Apr 2020, 9:14 AM
FS00047
6 odpowiedzi
+ 1
I cprrect your code case c so check it please. May be some errors since it was write by mobile https://code.sololearn.com/cipM9dJAqMQ7/?ref=app
23rd Apr 2020, 9:30 PM
george
george - avatar
+ 2
Oooo i found the problem. The problem in do{}while(cur!=null). If you check for example you have 2 elements you take start element not equal, then go do while, where you make prev =cur, cur=next check cur and cur not equal, then you make one more time prev=cur cur=nex but next is 0 in this case)))). So make changes just instead of do while set while(curr!= null) do operatiin
23rd Apr 2020, 9:09 PM
george
george - avatar
+ 1
You can also unite starting check in intermediate check in one while do!!!! It is example of linear list)
23rd Apr 2020, 9:11 PM
george
george - avatar
0
Could you please told me what you comment//uncomment
23rd Apr 2020, 9:01 PM
george
george - avatar
0
Thank you george
24th Apr 2020, 7:46 AM
FS00047
0
U r welcome!
24th Apr 2020, 8:13 AM
george
george - avatar