Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

using namespace std;

namespace

  • Please log in to reply
2 replies to this topic

#1 Hunter100

Hunter100

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 292 posts
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly, Bash

Posted 12 February 2010 - 05:22 PM

Hello all,

My C++ For Dummies book is an invaluable tool to me as I learn, but some of the things in there I don't understand. One of them is this line of code in every program:

using namespace std;

It is after library declarations...E.g.

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
  • 0

#2 CommittedC0der

CommittedC0der

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1065 posts
  • Programming Language:C#
  • Learning:C#, JavaScript, PL/SQL

Posted 12 February 2010 - 05:50 PM

"using namespace std;" includes sirten files that lets us call any function in the std namespace(the namespace std; files) without having to prefix it so "std::cout" can now be written "cout". Does this answer your question?
  • 0
There IS a war going on for your mind.
Nothing of eternal significance happens besides prayer.

#3 Hunter100

Hunter100

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 292 posts
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly, Bash

Posted 12 February 2010 - 05:51 PM

Thanks that does.
  • 0





Also tagged with one or more of these keywords: namespace

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download