2 days into programming, need some help

Pages: 12
in that program why would you not use namespace std? there is no need for the other functions and trying to teach him about those is not what beginners need to worry about until the lesson plan teaches them( that's why people make lesson plans, so you don't start out with things like classes before functions while skipping arrays and other simple data aggregates) about it so they can make an educated decision on using it or not depending on the program.
Last edited on
why wouldn't you? it is a good habit to have, unlike using namespace std, which is a bad one.

people aren't stupid, adding std:: to the start of a function name or class name rather than putting "using namespace std" at the top of the file won't suddenly make all beginners quit programming due to how complicated it is, they have more to think about than a prefix, something which most, if not all, spoken languages have.

the quicker they get used to typing std:: the better, because when, and not if, you get attached to just typing that single line at the top of every file, it will be so much harder to let go of it when you need to, luckily for me I learned about it a week or two after I started, so it wasn't that hard, but it took me several long days of typing random projects to get used to it, imagine if you had used that single line shortcut for a month? or 6? habits are always hard to break, regardless of what they may be.
Not to mention if you ever have to add some more code that uses another namespace with conflicting names to your program. God knows how much of a hassle that would be
my point is, if you do not know what namespaces are then there is no need for specific ones other than the std one, there is no point in teaching if you just say do this because it is better, it is teaching if you say what namespaces are, which is a little advanced for a person starting 2 days ago. along with the fact that if you are using more/other namespaces i would assume you know that you would not do using namespace std; its just simpler for beginners before they learn what namespaces are.
When I used the hello world program it works in devC++ with no errors. I tried the same code using Code::Blocks and it returned 8 errors. Now I am more confused. I think I might stick to one compiler until I get a feel for the basics to not get to wrapped up with too much.
ignore the argument about namespaces, just do
cin.ignore(); or
std::cin.ignore();
and your program should remain open while your testing it.
its easy. just use getch(); function at the end of main(). it will halt the screen.
ignore the argument about namespaces


Seriously. Sometimes I think users just want to sound important. It's a pointless argument 2 days into C++... Furthermore, if something is "bad" at least give an explanation.
I did give an explanation, and it isn't pointless.

don't use dev c++, it is out of date, use codeblocks and fix your errors.

watch these tutorials, they help a ton.

http://www.youtube.com/watch?v=tyVhn0FWWB4

and uiho, do beginners know what "using namespace std" means? I doubt it, so what extra confusion is there between that and knowing to always prefix count, endl and cin with std:: ? you don't have to teach them on the first day what it means, just teach them that they should always do it, and get around to the why part later on.
Last edited on
do beginners need to use functions for cout and cin and string etc...? it means using the standard version, its not hard to use any of the stuff, its just easier and covers all the statements that might need an std:: that they are learning? use whatever you want, they both do the same thing for all intents and purposes to a new programmer.
Thanks to everyone again for all replies

@ Zephilinox - Thanks for that youtube link, the tutorials in the videos are giving me a great visual understanding to the language. I am already in tutorial #7 where they explain different variable types. I am finding it 100 times easier having the visual representation than reading my sams teaches you c++ book.

I have learned a lot these couple days and I went to microsoft and downloaded the visual studio express free tools for c++. I just love that compiler and I find it easier for me to understand. I just have to make sure to include the stdafx.h but this is a blast. I love the simple explanations in that video and it really does spoonfeed the basics. Right now I am focused on just learning simple things, I usually just get the code from the tutorial and then i play with all the code to see what errors I get or dont get.

What I am noticing right now is I was rushing it in the start. Now I kinda want to know what iostream is rather than just typing it. So I go online and read it, even if I dont understand much of it but at least it will be engraved for when I cover it more in depth later on. I find that with a slow approach I am learning so much more. Anyways yeah thats pretty much my update I will definately be posting more stuff in the future.

Thanks again to everyone for the links, tips and everything. Much appreciated!
Topic archived. No new replies allowed.
Pages: 12