Advertisement

C++ Workshop - Getting Started with C++ (Ch. 1 & 2)

Started by June 01, 2006 11:40 AM
182 comments, last by Dbproguy 16 years, 4 months ago
Great questions jwalsh! If you are unsure of an answer to a question and don't want to post here, feel free to PM one of us tutors. We would be glad to help you!
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Quote: Original post by jwalsh
Greetings All,

Namespaces are a not really a complicated topic, but without a more in-depth knowledge of C++ than chapters 1 and 2, it can seem a bit overwhelming. The ironic thing is that many of these questions will be answered in the chapter on namespaces, but many of the questions will answer themselves as you become more intimate with the language. They'll just start to "make sense," as we explore classes, scope, and other items which might warrant a namespace. But as many of you have asked the relevance of namespaces early, I'll post a brief example and explanation.

Purpose of Namespaces:

[...]

Cheers!


Thanks a lot ! I am totally new to Cplusplus and still a beginner to programming in general ( has some basic python experience ) and I had some trouble understanding the namespaces concept. It was the only thing that wasnt clear in my mind from chapters 1-2 but after reading this... ! You answered all the question I was asking myself about namespaces :)

I would also like to point out that the "Teach Yourself Cplusplus in 21 Days, 2nd Edition" has many errors... I dont know if they come back in the 5th edition but if your starting from scratch you could struggle to find why your code doesnt compile. These issues have been answered in this topic but for exemple, the 2th edition book show the Hello world source code as follow :

 1: #include <iostream.h>2:3: int main()4: {5:    cout << "Hello World!\n";6:        return 0;7: }  


Now after reading what you guys said I saw what the errors were but it is bad to be learning with a book that is wrong :/ . ( <iostream.h> .h is not standard C++ and cout is missing its namespace ) There seems to be no mention at all of the namespaces in the first 10 chapters and beyond...

P.S. I am using Microsoft Visual C++ 2005 Express Edition. I have learned about the workshop one day before it started and my "Teach yourself C++ in 21 Days (5th Edition)" is still wandering in the mail, hence why I am using the online 2th edition text book.

P.P.S. Thanks to jwalsh, GameDev and all the tutors for making the workshop :)
Advertisement
Yeah, I also noticed a couple errors and I believe they are posted in the first post. If you see any errors, make sure to point them out so we can address them. Nothing is more frustrating then trying to find a bug when the code in the book is wrong. Glad you like the workshop!
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
I think its a really great thing you're doing here, so thanks!

I just have one request, would it be possible for exercises/quizes/etc to be posted in a seperate topic? This has the advantage of them being easier to find, but the main advantage is that people can still read the main thread for the week without fear of stumbling across answers which they wanted to work out for themselves.
Vyper,

Unfortunately, this forum is currently broken, and myself and the tutors are unable to create any new threads. But yes, it was my idea recently that we have a separate thread each week, 1 for student questions, and 1 for Tutor "quizzes." I was also planning to pull out key topics such as compiler/IDE installation and configuration into its own thread.

Unfortunately, with the forum currently broken, the only way to go about doing that is to post in a different forum and then beg the moderators to move the thread into our forum. Also, the GDNet forum software doesn’t allow the moderators to move individual posts...so all the stuff in this thread will have to be manually copied over to the new threads.

In the mean time, I have asked that nobody post the answers to the quizzes, and so far no-one has done so. Hopefully the forum will get fixed soon. On Saturday morning, however, I'll open up the thread for answers to the quiz questions. In that way we gave people a few days to try to answer them on their own, but we also make sure that people are able to check their answers to see if they're correct. Hopefully this method is acceptable to everyone. Next week's thread will be posted Monday morning as will be the case from now on.

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
I've created a thread for that purpose. Feel free to use it.

jwalsh - if you need other threads created, just PM me.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
[opinion]
Quote: Original post by jwalsh
[Extra Credit] What is self-documenting code? Does that remove the need for comments?

Not sure that I like this question a whole lot, good thing its extra credit. All things considered there are two correct schools of thought on that subject, and as such the answer is quite non-trivial.
[/opinion]

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Quote: Original post by Washu
[opinion]
Quote: Original post by jwalsh
[Extra Credit] What is self-documenting code? Does that remove the need for comments?

Not sure that I like this question a whole lot, good thing its extra credit. All things considered there are two correct schools of thought on that subject, and as such the answer is quite non-trivial.
[/opinion]


Agreed. There's not really a *correct* answer to that question. I just want to give people the opportunity to begin thinking about programming style early, so they can decide for themselves the best way to document their code.

[opinion]
Consistency is perhaps the only *correct* solution.
[/opinion]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Quote: Original post by Fruny
I've created a thread for that purpose. Feel free to use it.

jwalsh - if you need other threads created, just PM me.


Who is going to be the first brave soul to post there answers in the thread?

- Dave
Quote: Original post by ph33r
Quote: Original post by Fruny
I've created a thread for that purpose. Feel free to use it.

jwalsh - if you need other threads created, just PM me.


Who is going to be the first brave soul to post there answers in the thread?

- Dave

I don't think anyone need be afraid of answering, the whole point of this is to learn, not to make jests at the expense of each other. I would answer, except that I have no idea what I'm doing with C++ (as evidenced by my journal) [grin][lol][lol][lol]

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

This topic is closed to new replies.

Advertisement