Kamikaze_Badger Posted July 12, 2005 Posted July 12, 2005 std::cout <<"Hello World\n"; right? Just wondering, I just began learning C++. dont bash me for being a n00b. edit: so would this be a valid program? #include <iostream> using namespace std; void didit() { /*std::*/cout <<"I did it\n"; } main () { /*std::*/cout <<"Hello World\n"; didit(); } 508108[/snapback] Un-needed scope operator errors fixed. Share this post Link to post Share on other sites More sharing options...
martymcfly Posted July 12, 2005 Posted July 12, 2005 (edited) those are unneeded? the book I use has a sentence that says to "just view std::cout as the output function and std::cin as the input command". I was under the impression that you do need it. edit: do you think it is a good start? Edited July 12, 2005 by martymcfly Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 those are unneeded? the book I use has a sentence that says to "just view std::cout as the output function and std::cin as the input command". I was under the impression that you do need it. edit: do you think it is a good start? 508127[/snapback] it aint needed because of the "using namespace std;" thing If you didn't have that, you'd have to do the whole std::cout blahness... Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 what do u have the std infront of cout and cin for what does std mean / do? Share this post Link to post Share on other sites More sharing options...
martymcfly Posted July 12, 2005 Posted July 12, 2005 (edited) oh! KB added the using namespace thing. This is what happened: KB reads code notices no using namespace thing adds compiles errors says I dont need those thing I did before it was edited Edited July 12, 2005 by martymcfly Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 12, 2005 Posted July 12, 2005 No, I harmed many potatoes to fix that code for you. Appreciate the Padawan of the mighty Moo! Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 what does putting std infront of cout & cin do? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 what does putting std infront of cout & cin do? 508138[/snapback] http://www.glenmccl.com/ns_comp.htm I think that explains it fairly well.. Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 so it does not really affect the code it just tells which library to use the command from? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 so it does not really affect the code it just tells which library to use the command from? 508148[/snapback] Seems about it, yeah.. Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 Sweet I actully understand something. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 12, 2005 Posted July 12, 2005 Or, you could be a real man and open up the iostream header file, and then just copy and paste the cout... I want to say function, but it's part of the namespace, so I'm not sure... Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now