Saturday, January 7, 2017

A (very) tiny update

As you may or may not have noticed in my latest submission, there is another function in between all the lines of code:

         /* Call: catchInifiniteLopp */
         catchInfiniteLoop();

This one is a new function i fit into my universal Utility.h file, which, if you happen to use any of my code in part or in total - (please feel free to), you will need, for this function to work. There is nothing special about it. Basically it consists of these two functions:

   cin.clear();
   cin.ignore();

Also i decided to change my pause function which is also in the aforementioned header file. function, strange that i used it in there, before i even knew that it was a function in the first place. That aside, the important part about this change is is that now a potential security hole, or incompatibility, or resource hog - depending on who you ask it is, is closed and done away with. So far i used system("Pause"); in there to keep the console open. I was aware that it wasn't the best solution to go about doing this, but what did I know a mere 4 months ago when i started with the book, and made my first steps in writing any code in C++? I guess now I am, and you too, are going to be on the safe side.

If you wish to use my header file, you can download it here: "Utility.h"

And now it is back to more lines of code, half way through in this Programming Challenge section of this chapter, hurray for me! I wish all of my fellow learners success, as always, and hopefully you are better in keeping your code for the challenges shorter than I do. *sighs*

No comments:

Post a Comment