c++ code examples

Started by
16 comments, last by Paradigm Shifter 10 years, 11 months ago

I'm transitioning from Java to C++ and I'm finding the process of going through a book very tedious. Would it be a good idea to look over code examples and just see if I can figure out what's going on there as opposed to finishing this book? (Accelerated c++).

Also, can anyone provide some decent C++ code examples?

Advertisement

I have done this and found most of it quite easy to understand. Most of its the same if written different and the few things that are brand new can be easily looked up. I have done lots of java but only basic C++ but I can still read through programs and understand whats happening so it does help.

Try the tutorial series in my sig. It shows how to build a non trivial c++ app in detail.
What level of C++ are you looking for?

Relatively simple C++ can be found all over the web in open-source projects. If you can read chunks of code from arbitrary C++ open-source code bases, and have a decent idea of what's going on, you're doing fine.

There's also stuff like Boost which is C++ but highly advanced in most cases and probably not something you're doing to encounter often.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Well, it's still fairly basic, I'm not extremely far into the book(Haven't had a ton of time to work on it). My goal is to transition from Java into C++ and be writing the same level code as quickly as possible. Any tips?

Write code. Lots of it. Use the book as a reference if all else fails, or (preferably) just look it up online.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Write code. Lots of it. Use the book as a reference if all else fails, or (preferably) just look it up online.

Any suggestion on things to write? I always have a hard time thinking of good programs to write with good learning value

Also, is the tutorial at cplusplus.com any good?

I would say if you are starting out anything and everything has good learning value because you are trying new things. So why not start with a simple game like tic-tac-toe or hangman and then expand on it to use new programming concepts as you learn them.

"Good learning value" is not something you're really in a position to gauge accurately, frankly. You should write anything and everything you can think of, whether you immediately recognize its value or not.


Have a pesky problem that you're solving by hand? Automate it. Doing boring busy work in real life? Automate it. Have a game you enjoy playing that might be fun to reimplement (even if just a barebones clone)? Do it.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

cplusplus.com is rife with errors and misinformations. I'd stick to another site, until you are good enough to spot an error in their code before wondering why not only does their example not work, but their specifications are missing or impossible.

I've tried emailing in corrections, but he didn't quite get what I was saying; he kept replying with a description of what the functions are supposed to do, despite me telling him that his example function does not do that at all.

This topic is closed to new replies.

Advertisement