Jump to content

  • Log In with Google      Sign In   
  • Create Account

c++ code examples


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
17 replies to this topic

#1 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 28 April 2013 - 06:13 PM

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?



Sponsor:

#2 walsh06   Members   -  Reputation: 662

Like
0Likes
Like

Posted 29 April 2013 - 01:57 PM

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.



#3 Serapth   Crossbones+   -  Reputation: 5460

Like
2Likes
Like

Posted 29 April 2013 - 02:28 PM

Try the tutorial series in my sig. It shows how to build a non trivial c++ app in detail.

#4 ApochPiQ   Moderators   -  Reputation: 15698

Like
3Likes
Like

Posted 29 April 2013 - 03:10 PM

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.

#5 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 29 April 2013 - 04:29 PM

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?



#6 ApochPiQ   Moderators   -  Reputation: 15698

Like
5Likes
Like

Posted 29 April 2013 - 04:52 PM

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

#7 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 29 April 2013 - 07:47 PM

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?


Edited by stein102, 29 April 2013 - 07:48 PM.


#8 walsh06   Members   -  Reputation: 662

Like
1Likes
Like

Posted 30 April 2013 - 08:38 AM

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.



#9 ApochPiQ   Moderators   -  Reputation: 15698

Like
4Likes
Like

Posted 30 April 2013 - 11:40 AM

"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.

#10 Ectara   Crossbones+   -  Reputation: 2967

Like
1Likes
Like

Posted 30 April 2013 - 01:27 PM

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.



#11 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 30 April 2013 - 10:13 PM

Can you link me to a good C++ tutorial then?



#12 jbadams   Senior Staff   -  Reputation: 18575

Like
1Likes
Like

Posted 30 April 2013 - 11:05 PM

LearnCpp.com is pretty good.



#13 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 01 May 2013 - 04:06 PM

LearnCpp.com is pretty good.

 

How far would those tutorials take you?



#14 Chad Smith   Members   -  Reputation: 1132

Like
0Likes
Like

Posted 02 May 2013 - 01:05 PM


LearnCpp.com is pretty good.


How far would those tutorials take you?

Just looking at the contents and not the material inside each tutorial it looks like they'd teach a lot and covers a lot of material. I didn't look to see how in depth they were but considering who linked them I would trust they are good.. Though of course just learning from tutorials won't be enough. Actually applying these concepts in code is what takes you far. By doing this you see what can and can not be done and then you go and research how it can be done. Then you apply that. Keep doing that and next you know you'll find yourself programming in C++ no problem.

Though keeping a good book on C++ is still important in my opinion even just for reference or maybe learning the Standard Library.

#15 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 02 May 2013 - 10:30 PM

 


LearnCpp.com is pretty good.


How far would those tutorials take you?

Just looking at the contents and not the material inside each tutorial it looks like they'd teach a lot and covers a lot of material. I didn't look to see how in depth they were but considering who linked them I would trust they are good.. Though of course just learning from tutorials won't be enough. Actually applying these concepts in code is what takes you far. By doing this you see what can and can not be done and then you go and research how it can be done. Then you apply that. Keep doing that and next you know you'll find yourself programming in C++ no problem.

Though keeping a good book on C++ is still important in my opinion even just for reference or maybe learning the Standard Library.

As for books, I have Accelerated C++ and Programming Principles and Practice Using C++, are there any other books I should look into?

I just want to make this transition as fast as possible so I can get back into writing games like I was in Java.



#16 Dragonsoulj   Crossbones+   -  Reputation: 2111

Like
0Likes
Like

Posted 03 May 2013 - 01:33 AM

As for practice: http://projecteuler.net/

Do some of those, even if it is just the beginning ones. It gives you projects to work on as you are learning. Have a new feature you just learned? Try to use it to solve one of the problems. Your program may not be the most direct way to solve the problem, but it gives you something to work on and you can use the direct way to verify your answers.



#17 stein102   Members   -  Reputation: 475

Like
0Likes
Like

Posted 03 May 2013 - 04:54 PM

As for practice: http://projecteuler.net/

Do some of those, even if it is just the beginning ones. It gives you projects to work on as you are learning. Have a new feature you just learned? Try to use it to solve one of the problems. Your program may not be the most direct way to solve the problem, but it gives you something to work on and you can use the direct way to verify your answers.

 

Amazing, I totally forgot about these. Haven't really looked at them since I first started programming. Going to give these a whirl for sure, hopefully I can get a good amount of them done. As for books though, what would you suggest? I was considering the following books to aid my learning:

 

The C++ Programming Language

The C++ standard Library

 

Which one of these would better suit my needs?



#18 Paradigm Shifter   Crossbones+   -  Reputation: 5371

Like
0Likes
Like

Posted 03 May 2013 - 04:59 PM

The C++ programming language (the Bjarne one) is pretty heavy going, I wouldn't recommend it for learning, but it is a good reference. Dunno if the C++11 update is out yet, I'd hold out for that if it hasn't. But as I said, not a good book for learning (reads more like a university textbook).

 

The standard library one is probably going to be better for learning.


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS