(11-09-2009, 08:38 PM)nevets04 Wrote: [ -> ]That would be silly to type std:: before every line...
Exactly, but you do what fits the situation; In this case, a Hello World program doesn't need to preload everything in the std library. It's quicker/smaller to pick-and-choose. Generally, though, it's better to say "using namespace std;"
(11-09-2009, 06:31 PM)J4P4NM4N Wrote: [ -> ]Btw, I thought the main() function had to be of return type "int" as I wrote?
It should, yes.
(11-09-2009, 08:38 PM)nevets04 Wrote: [ -> ]That would be silly to type std:: before every line...
It's only before the actual use of STL, not every line as such. I rarely do "using namespace" for third-party libraries, also you should never used a "using namespace" inside a header file because of
namespace pollution.
(11-09-2009, 09:46 PM)J4P4NM4N Wrote: [ -> ]Exactly, but you do what fits the situation; In this case, a Hello World program doesn't need to preload everything in the std library.
Pre-load? I think you're confusing what "using namespace" actually does, it promotes a namespace to a global scope (essentially dissolving the namespace), there is no "pre-loading" going on since you would still only be able to access code that you have included.
(11-09-2009, 09:46 PM)J4P4NM4N Wrote: [ -> ]It's quicker/smaller to pick-and-choose.
Well, you do generally tend to include the headers for the classes you need and not everything since that would increase compilation time. Still, "using namespace" has nothing to do with compile time.
(11-09-2009, 09:46 PM)J4P4NM4N Wrote: [ -> ]Generally, though, it's better to say "using namespace std;"
Once again, watch out for this in header files due to namespace pollution.
C++,if you master it that's it all the other languages are piece of cake.
I'll have to agree with bsdpunk on this one, you can't really compare them. :/
(11-09-2009, 09:46 PM)J4P4NM4N Wrote: [ -> ]Generally, though, it's better to say "using namespace std;"
Do try avoid using that in a large project. I usually just "use what I need" in larger projects. (
using cout; for example.)
C++ is the best of programming fundamental...
i prefer c++... very powerful programming language.
> Btw, I thought the main() function had to be of return type "int" as I wrote?
Returning 0 tells the program it's done, but it isn't needed.
I want to say Python, because of it's easy of use, but I'm going to say C++ because of it's power.
c++ Because python is basic and should be the first programming language you learn but it is really hard...But i suggest c++