Namespace & <iostream> help required for a confused noob

This is a discussion on Namespace & <iostream> help required for a confused noob within the C++ Programming forums, part of the General Programming Boards category; Greetings. I`ve been wanting to program for ages but have been put of by the fact it seems so confusing ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    Question Namespace & <iostream> help required for a confused noob

    Greetings.
    I`ve been wanting to program for ages but have been put of by the fact it seems so confusing and for some reason i`ve always had this niggle inside me that told me to program, and so about 4 hours or so ago i did.
    I`m using the tutorial/s on this site and am finding them helpful so far.
    I am however (and this is one of the things that has put me off programming) confused over what a namespace is, i looked on the FAQ to this site and all over the web,and i just can`t understand them, so can someone please explain it to me in simple terms.
    Also do you use <iostream> on all projects?

    Many Thanks

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,388
    a namespace is a space that contains names.

    the <iostream> header contains declarations for functions, classes, and objects that you use throughout your program. if you want to use cout, you have to include <iostream>. all of the items in the <iostream> header are in the std namespace. you could have another namespace with a different name, but that also contains an object called cout, and it would not conflict with std::cout. that's why namespaces are important. they prevent name collisions.

  3. #3
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,689
    Also do you use <iostream> on all projects?
    Not necessarily.

    If you create a graphic user interface for your program, the type of text-only command based IO that <iostream> let's you do is a lot less important.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Friend of namespace or of namespace function?
    By Programmer_P in forum C++ Programming
    Replies: 18
    Last Post: 03-13-2011, 06:46 PM
  2. Noob getting confused by booleans
    By Nathan the noob in forum C++ Programming
    Replies: 7
    Last Post: 06-27-2008, 03:50 PM
  3. Cant use std namespace, help required
    By esaptonor in forum C++ Programming
    Replies: 16
    Last Post: 08-15-2006, 11:15 AM
  4. iostream.h (vs) iostream
    By Brain Cell in forum C++ Programming
    Replies: 5
    Last Post: 11-05-2004, 07:20 AM
  5. Required Noob Info
    By ober in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-26-2004, 11:24 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21