Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[C++] Learning a programming language

  1. Mar 4, 2013 #1

    trollcast

    User Avatar
    Gold Member

    I'm trying to learn C++ at the minute and I've managed to get over the basics, I/O, Conditionals, Repetition up to and a bit of pointers.

    Now what I'm wondering is should I get a textbook that is solely on C++, eg. Barjne Soustroups one, and learn specifically C++.

    Or learn by doing problems on places like Project Euler and prehaps maybe a book on another topic thats written in C++, specifically something like this: https://www.amazon.com/Data-Structures-Algorithm-Analysis-Edition/dp/032144146X , and learn from the code examples and practice?
     
    Last edited by a moderator: May 6, 2017
  2. jcsd
  3. Mar 4, 2013 #2

    phyzguy

    User Avatar
    Science Advisor

    The best way to learn how to write code is to write code. Pick some problems that you are interested in and try to write code to implement these problems.
     
  4. Mar 4, 2013 #3

    jtbell

    User Avatar

    Staff: Mentor

    You mean this one?

    https://www.amazon.com/Programming-...qid=1362436681&sr=1-3&keywords=stroustrup+c++

    I haven't seen it myself, but it's gotten good reviews on Amazon, and I think anything Stroustrup writes about C++ is worth reading. I see a new edition of his "bible" is coming out in May:

    https://www.amazon.com/C-Programmin...qid=1362436681&sr=1-1&keywords=stroustrup+c++

    I wouldn't use it as a textbook, although some people claim to have done that. I think of it as the ultimate reference. Over the years, previous editions have been my "go-to" book when I want to refresh my memory about some C++ feature.

    Depending on your learning style, you might also consider https://www.amazon.com/Accelerated-...qid=1362437251&sr=1-1&keywords=koenig+moo+c++ by Koenig and Moo. Its strong point is in learning how to use the standard "containers" in the C++ standard library, or what many books still call the "STL" (Standard Template Library): vectors, lists, etc. instead of plain old arrays. It's all based on one or two examples which are developed progressively in succeeding chapters, instead of using free-standing examples in each chapter. So it's best read through (and worked through) from beginning to end, which isn't good if you like to jump around depending on which topic catches your fancy at the moment.
     
    Last edited by a moderator: May 6, 2017
  5. Mar 4, 2013 #4
    Trying to learn C++ by doing Project Euler is going to discourage you quite a bit. It's not an easy task. Project Euler is very difficult (at least it was for me). It requires better knowledge in math than it does programming, and I'm the other way around.
     
    Last edited by a moderator: May 6, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: [C++] Learning a programming language
Loading...