Thread: newbie needs help comprehending simple thing

  1. #1
    A helpless one

    newbie needs help comprehending simple thing

    Hey, i just got a book on C++, and i didnt get very far in it. To be truthful, i didnt get too far past the hello world program. I'm having truble comprehending what the line:

    useing namespace std;

    Everything else is clear. The book says that the line "states that we are using statements of the std family". That would have been a valid explination to me if the hello world program didnt work without it. Can someone enlighten me about this namespace thing? Also, the tutorials here at Cprogramming mention nothing of this(i think).

  2. #2
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    considering you're a noobie you shouldn't concern yourself with this yet....

    but just for reference in the OLDER style of #include files you used ".h" ending without "using namespace std;"

    and in the NEW (C++) standard you omit ".h" ending and type the following "using namespace std;"

    using namespace std;
    that's all for now,
    your explanation in the book is adequate enough for your level, however if you need to know now all the details i'm sure you can find a lot of stuff on the internet....i wouldn't recomend it at this time

    good luck


  3. #3
    a helpless one
    ahhh... it all is clear now... Thanks man, and the luck u wished me has been processed. Uhm... may i ask another question? *assumes he may* Does it matter if i use "The old" way or "the new" way? Also, he describes some odd difference in int main() and void main(). or somethin like that. all these stupid things that dont matter really vex my perfectionism....

  4. #4
    A helpless one
    hmm... another thing:
    in using namespace std;
    where std is, are there other things that go there? if so, why?

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Originally posted by A helpless one
    hmm... another thing:
    in using namespace std;
    where std is, are there other things that go there? if so, why?
    Yes. There are other name spaces, you can even create your own. You may want to do a bit of reading on the topic.

    Hope is the first step on the road to disappointment.

  6. #6
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    well, most likely, one day, people will stop using the old standard that's why i believe one should stick to the new one if he/she can

    for now it doesn't really matter what you use, without confusing you, certain libraries that you include have different functions and capabilities, but the bottom line is that they do similar things, the new standard keeps on upgrading all the time so if you stick to the new one it will probably be easier for you for now...

    about "int main()" and "void main()" ======= if my memory serves me correctly "void" is used if you program under Unix and "int" for pretty much everything else, (it's a matter of a return type) once again, i recommand sticking to "int main()"

    to be honest with u, if you are learning on your own from books, i recommand trying to learn the "basics" from 2 or 3 different books at the same time, this way you will be able to have 3 different points of view until you develop your own, based on my experience 1 book was never enough, one was always missing something....

    about your second question: see, like i said you should just take "using namespace std;" the way it is now, without trying to understand everything at once, your question is phrased properly, but if you start learning about "namespaces" you'll be able to answer your own question easily...


  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002

    note to matheo: you use int in unix too, you can even ask the creator of c++ himself bjarne stroustrup, he'll tell you the same
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just a simple thing.
    By steveiwonder in forum C++ Programming
    Replies: 14
    Last Post: 11-03-2005, 03:39 PM
  2. Newbie! Help With Two Simple C++ Programs.
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 09-06-2005, 08:38 AM
  3. Simple project becomes very annoying.
    By ... in forum C++ Programming
    Replies: 6
    Last Post: 02-27-2002, 10:42 PM
  4. Need some really simple help (complete Linux newbie)
    By Hannwaas in forum Linux Programming
    Replies: 11
    Last Post: 12-10-2001, 02:16 PM
  5. Newbie Question on a Loop/If-Else thing
    By Warped1 in forum C++ Programming
    Replies: 2
    Last Post: 10-11-2001, 02:46 PM
Website Security Test