i see
std::cout
a lot. is that becaue that dont name
using namespace std; at the top?
Printable View
i see
std::cout
a lot. is that becaue that dont name
using namespace std; at the top?
if it's a small program, declaring a global usage of the std namespace works without problems... but once you get into a complex project, with namespaces of your own, and others, and you've got a million different object scopes, it wont work out so nicely...
it's just good practice to use std::
so, just do it now, and later it'll make more sense to you as to why it's good to do it :)
but like I said, using namespace std; works you just need to know what it's doing ( :: )
hey, where did your dancing Bart go? I liked it! :D
add this line to the top of your code, and you could use cout simply. ;)
PHP Code:
#include <iostream>
I think you mean;)PHP Code:
#include <iostream.h>
<iostream.h> (old version of iostream and it's recornized by old compiler)
<iostream> (new version and it's unrecornized by old compiler)
i wanted to change my avatar i might put it back.. ooooooooo. u gave me an idea...Quote:
Originally posted by d00b
hey, where did your dancing Bart go? I liked it! :D
yup, so if he used <iostream.h> he wouldn't have to worry about namespaces :)Quote:
Originally posted by Unreg1stered
<iostream.h> (old version of iostream and it's recornized by old compiler)
<iostream> (new version and it's unrecornized by old compiler)
Instead, he gets to worry about newer compilers not including <iostream.h>. Also, it is perhaps good to keep in mind that for the most part, software is updated for a purpose :)Quote:
yup, so if he used <iostream.h> he wouldn't have to worry about namespaces
i changed my avatar, i mgiht change it again so its color is closer he to boards colors
MEEE i want avatar
I've got a nice avatar :)
Me too! look mine says N00B
Ruski's is the coolest avatar I've ever seen, I'd like one similar but can't be bothered to search for one.
If std::cout is good practice what about putting using statements at the top instead?
using std::cout;
usin std::endl;
etc, etc
They're fine... what I'm getting at is that it's not good to just slap "using ....." at the top of code because you've been told to, you need to know that it's a shortcut from having to write out the scope of something over and over; that's all I'm saying :)
and about the <iostream.h> thing, I wasn't serious about actually using that, I was saying that if you wanted to avoid having to specify the std scope for iostream, that you could use that... but, don't do it