error handling bad input

i don't know how to correctly handle errors in my program, instead of just printing them.

 


each function has a basic implementation on how to check for a certain situation, but i don't know how to deal with errors correctly instead of just printing them and continuing with function flow. could you please take a look?

the full code is on onlinegdb.com here: https://onlinegdb.com/Sy92Qsd123 (also can be compiled and it's really convenient).

if someone can load the code in his own computer, i would appreciate if you could also check if loading commands from a text file (insert, remove etc) works correctly.

so close to finishing it after a lot of hours.

thank you so much, and really appreciate your help and assistance. please help if you can
Last edited on
It entirely depends on the nature of the error. I.e. are you able do deal with the error or not. If you are not able to do anything with the error you may throw an exception. See:

http://www.cplusplus.com/doc/tutorial/exceptions/
https://en.cppreference.com/w/cpp/error/exception

or assert:

http://www.cplusplus.com/reference/cassert/assert/?kw=assert

Detecting bugs is good, programming with bugs is not good...
Topic archived. No new replies allowed.