i see
std::cout
a lot. is that becaue that dont name
using namespace std; at the top?
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!
add this line to the top of your code, and you could use cout simply.
PHP Code:
#include <iostream>
Never end on learning~
I think you meanPHP 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...Originally posted by d00b
hey, where did your dancing Bart go? I liked it!
yup, so if he used <iostream.h> he wouldn't have to worry about namespacesOriginally 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 purposeyup, so if he used <iostream.h> he wouldn't have to worry about namespaces
Turn no more aside and brood
Upon love's bitter mysteries
For Fergus rules the brazen cars...
i changed my avatar, i mgiht change it again so its color is closer he to boards colors
MEEE i want avatar
AOL: GrNxxDaY
IDE: Dev-C++ Beta 5 (v4.9.4.1)
Project: Eye of Sahjz (text-RPG)
If you think I may need help, please IM me.
I've got a nice avatar
what does signature stand for?
Me too! look mine says N00B
AOL: GrNxxDaY
IDE: Dev-C++ Beta 5 (v4.9.4.1)
Project: Eye of Sahjz (text-RPG)
If you think I may need help, please IM me.
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
Couldn't think of anything interesting, cool or funny - sorry.
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