+ 4

Problem with deleteNode function in an ordered linked list

Hi, I am learning about linked lists in C++ and attempted to write a program using classes described in a book. The unordered linked list functions seems to run fine, but the ordered linked list seems to have a problem with the deleteNode function. One compiler I run it through encounters a runtime error, but does not output any error messages. I'd appreciate if somebody could point out the issue that's causing the error and apparently halting the program. https://code.sololearn.com/cZI6zP4h4Asw/#cpp deleteNode function prototype //Line 413 deleteNode function definition //Line 493-544 (Side note: Was running into issues implementing without specifying 'this' for 'first', 'last', and 'count' member variables. I read I needed to specify 'this' for the compiler to understand I was referring to the object of the derived class versus the base class. Hence, you'll find all the member variables of the orderedLinkedList class are preceded by this->. If you know a better workaround, I'm all ears as I feel this impairs readability (but does allow the program to run!)).

27th Jun 2017, 1:40 AM
Joseph P French
Joseph P French - avatar
6 Respuestas
+ 9
Lol m8. Your error lies within line 514. You used '=' instead of '=='. And m8, for the love of cookies, save on the code comments. It's driving me crazy. xD
27th Jun 2017, 2:48 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
Marking. I will look into this later.
27th Jun 2017, 1:59 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
@Joseph It's always OK to keep the comments if you need them. I was just having it rough because it was a '=' through all the lines. :>
27th Jun 2017, 4:04 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
@Hatsy Rei wrote: << save on the code comments >> It's ever better to do too much comments than not enough ;P
27th Jun 2017, 3:40 AM
visph
visph - avatar
+ 5
@visph Yeah, that may be true. It's just annoying when comments add nearly 100 lines to a code you try to debug. Perhaps IDEs should include the option to censor all comments (?) when needed.
27th Jun 2017, 5:34 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
@Hatsy Rei, thanks a million! One little '='. I guess I became numb/blind to it after reviewing it so many times. Those comments are essentially what I copied out of the book. You recommend less comments?
27th Jun 2017, 3:34 PM
Joseph P French
Joseph P French - avatar