11-27-2014
|
39 | |
Software Engineer
Join Date: Sep 2011
Location: Gold Coast, Australia
Posts: 787
|
I usually type the namespace name because they're often very short so it doesn't matter. The best idea is to do that, or use the specific parts of the namespace that you need.
|
|
11-29-2014
|
40 |
Banned
Join Date: Jul 2014
Location: Omaha, NE
Posts: 610
|
Agreed that it is fine. However, I'm one of those people who type std::cout << "chvfhdgjb" << std::endl; I'm not sure why this namespace argument is even a controversy, it really doesn't matter which way you use it unless you get some uncommon error for it, in which case you can look it up online for a fix. |
12-02-2014
|
41 |
:
Join Date: Jul 2012
Location: Minnesota
Posts: 818
|
Thanks for the help and advice Tricxta and Jatz I'm still a little confused on the issue on namespaces though. Currently working on making a project list I can get working on. If you guys have any suggestions for good beginner projects such as the calculator. Which in fact did help me learn a Ton over the past two weeks that would be great. |
12-02-2014
|
42 | |
The muffin man
Join Date: Sep 2011
Location: Burger Refuge
Posts: 2,262
|
Consider a list that can store multiple types of shapes. Using this one list, store a square, triangle and circle. Iterate over that list and print out the area and name of each shape. Example pseudocode of populating such a list might be PHP Code:
You can use this formula for the area: Some links to get you started result from some simple google searches: http://www.tutorialspoint.com/cplusp...nheritance.htm http://stackoverflow.com/questions/2...l-methods-in-c If this exercise seems a bit daunting, other nice features to look at include generics(templates) and operator overloads. |
|
12-03-2014
|
43 | |
Software Engineer
Join Date: Sep 2011
Location: Gold Coast, Australia
Posts: 787
|
Also if you're looking for a basic dynamic array type, they're called std::vector's in c++. PHP Code:
|
|
12-03-2014
|
44 | |
The muffin man
Join Date: Sep 2011
Location: Burger Refuge
Posts: 2,262
|
|
|
12-04-2014
|
45 | ||
Banned
Join Date: Jul 2014
Location: Omaha, NE
Posts: 610
|
If you're all about "learning on your own," why are you not about "learning sequential steps"? If he didn't know how to pass parameters (a,b), there's no way he's going to learn pushing back objects with a bunch of variables not defined within the provided pseudo-code within that one reply. He should really be taking a look at C++ tutorials online where they list steps, not going from "Hello World" straight to "Use objective programming to 'add' shapes with variables for a parameter not given the basic usage for." ----------------------------------------------- I suggest that if you want to learn how to use C++, you should start with basic (yet fun) programming. Not console programming (borrriinnnggg...) Lazy Foo has some great tutorials for C++ with SDL so they teach you how to make little 2D programs. http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index.php Go ahead and click the Operating System you're currently using (windows, mac, Linux) and then select your C++ compiler (Code::Blocks, Dev-C++, Microsoft Visual Studio) and learn the fun way -- One that intrigues your mind.
I would *probably* literally think that was correct programming and it would confuse me. If you want to give him a learning experience, showing him a basic "push_back" function is not giving him an entire piece of code. He probably won't know what it is right off the bat, and therefore research it a bit. Or at least use it for future references. |
||