User forums > Using Code::Blocks

Single source, without a project file?

<< < (3/3)

RKCole:
So basically if I wanted to use cin, cout, and endl in a program I could use:

using std::cin;
using std::cout;
using std::endl; (I believe that's in the standard library)

Wow...those courses left me a bit more behind than I thought.  But thanks for the insight, there.  I'll do it that way from here on out.

Take care.

takeshimiya:
I think it's better to not use a using statement never. It more or less defeats the purpose of the namespaces.

DarkStar:
Wow!  Just a couple of hours and 11 replys.  Thanks!

After reading all that, I will keep using projects, overkill or not for a 20 line program.

Also, I have noticed that if you ask any two c++ programers about using namespace std;, you almost always get an arguement out of it. :lol:

For myself, I am trying to learn C++ from a book (this one) so for now I will just go along with what the book shows.  That happens to be using namespace std; inside any function that uses it, insted of being global (as of chpter 4).

I am personaly not going to type std:: in front of every cout and cin I use.  Not being a very fast tiper, I need the time savings. :)

thomas:

--- Quote from: DarkStar on January 15, 2006, 02:12:41 am ---That happens to be using namespace std; inside any function that uses it, insted of being global (as of chpter 4).

I am personaly not going to type std:: in front of every cout and cin I use.  Not being a very fast tiper, I need the time savings. :)
--- End quote ---
And there is nothing wrong with it! Do what you feel comfortable with.

Personally, I don't use the using keyword most of the time simply because I like the scope resolution operator (and I type fast enough, so it doesn't matter). To me, explicit scope resolution looks nice, and it helps me to remember where I pulled something from.
But that does not mean that using the using keyword is generally bad practice. Wheter or not to use that keyword is a personal preference, nothing more.

Navigation

[0] Message Index

[*] Previous page

Go to full version