Quote (Minkomonster @ 18 Nov 2014 00:24)
Keep in mind that he is new, and will not run into the problem using directives can cause for quite some time. However, I do agree learning proper programming standards early is better. But overloading them with these things from the start can be cumbersome and disadvantageous to their overall improvement.
But while I have your attention, NinjaSushi2, do you understand why it is improper? I say this not to call you out, but for I noticed earlier you were having issues with a simple do while. It seems odd to me that you are bringing up concepts like this in his thread, when it would appear you are at the same level as him. So, for the sake of joint learning let's continue this discussion: do you understand what issues can arise with the using directive in larger software projects?
This is not entirely true. 0/1 are not for true and false. It is actually for EXIT_SUCCESS and EXIT_FAILURE which are defined in cstdlib, you can also return any other integer which would be user defined error codes. The reason it returns an int is so you can tell the user what the reasoning is behind your program closing, it was either successful, a failure, or perhaps something else.
I don't know very much either but I try to help when I can. I've developed the idea that if I am incorrect in some way, someone will correct me. If it's above my head I just stay out and lurk the threads. As to your question:
I had wondered why I always saw std::(your code handle here) and figured it was carried over as good practice from C. Then I decided to Google it one day and found a much more logical reason that was written in a very elegant yet simplistic way. Found this on Stackflow.
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
I usually try to Google my problems first. As for the do while. I was having a derp moment and didn't realize my close bracket was in an incorrect place. (Long day of school and studying. 0800-2100)
Quote
This is not entirely true. 0/1 are not for true and false. It is actually for EXIT_SUCCESS and EXIT_FAILURE which are defined in cstdlib, you can also return any other integer which would be user defined error codes. The reason it returns an int is so you can tell the user what the reasoning is behind your program closing, it was either successful, a failure, or perhaps something else.
Yes I agree. I am aware of the exit command. I like the return 0; because that was what I was first taught to determine the success of my program. When I see my zero I know that my entire code executed completely, though perhaps not always the expected outcome.
Please feel free to correct me anytime. I highly value your opinion and a few others.
Quote (New International Version)
Do not rebuke mockers or they will hate you; rebuke the wise and they will love you.