Rhine720 said:
I'm $0.02 richer then ibcnunabit =]
I am LOVING Accelerated c++
The only thing i dislike is the whole return 0;
and std:: cout
Are those important things I should adopt? Man programmers that I do know usually do a simple cout without stating the function library(std)
Also
After every input i use cin.ignore();
and before I end the program instead of return 0;
I use cin.get();
The reason is mainly because I'm using bloodshed,but is my current practices okay if i were in a professional programming situation?
Hi!
Glad you like the book!
Regarding the questions:
(a) int main() { return 0; } -- yes, this is
very important; for a few-mins.-long explanation, see e.g. a lecture (by Richard Buckland, UNSW):
// more precisely, just 30:40-37:00, answering to "Can you use void main()?" ;-)
(b) Bloodshed Dev-C++ -- it is a bit outdated -- it has not been under development since 4 years ago; consider switching to something more up-to-date instead, like Code::Blocks:
http://en.wikipedia.org/wiki/Code::Blocks
Instead of playing w/ std::cin.get(), etc., it might be easier just to run the app from the console/shell window :-)
(c) namespaces -- see
http://www.devx.com/tips/Tip/12534
Personally, I prefer
using declaration (e.g.
using std::cout) rather than
using directive (like
using namespace std;) -- that way, I am always sure which keywords are in the scope and I avoid "polluting" it.
Note, however, that in libraries (header files thereof) which are intended for production use it's best not to use using directives nor declarations at all (or as little as possible), always using fully qualified names instead -- precisely in order to avoid namespace pollution (e.g. you might have two teams of developers working on the modules of a multimedia library, say Video Team and Music Team -- there might be functions like Music::Load() and Video::Load() -- neither of the teams would be very happy if one of the others decided to shove its own "Load" down everyone's throat, right?).
Hence, besides making larger code easier to read (helping one to know where all of the names are coming from), it's a good practice to get used to fully qualified names, as sometimes they're really necessary.
In "Accelerated C++" there is more on that topic -- see 4.3/67 (and later also 9.2).
Hope that helps!