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 C/C++ through exercises

Tags:
  1. Feb 22, 2017 #1
    I often find it quite frustrating to learn a programming language through a book; I always find myself skipping through huge parts of the book I have to read before moving onto the exercises. That was the main reason I did not ace my Python exam at university; I was told to use syntax I hadn't even seen until exam. I had done most of the exercises, but apparently not the right ones.

    However, I am quite fond of websites like Codeacademy; You get a bite-sized text to read before you are told to use it in an exercise. However, it does not go very in-depth. Also, it does not cover C or C++.

    Are there books or other resources that are structured like that? This question is about C and C++.
     
  2. jcsd
  3. Feb 22, 2017 #2

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    I have always been a big fan of the Schaum's Outlines series because it emphasizes examples and exercises. I have only used them for mathematics and physics subjects, but from the reviews, it seems like "Schaum's Outline of Programming with C++" is similar.
     
  4. Feb 22, 2017 #3

    jim mcnamara

    User Avatar

    Staff: Mentor

    Just a quick note: C and C++ are very different. Pick one to learn. Not both at the same time. Bad idea.

    You can learn enough C in a few months to accomplish a many things. C++ has the STL, which takes a long time to learn. And this is a primary reason why the two languages take very different approaches to solving the same problem.
     
  5. Feb 22, 2017 #4

    QuantumQuest

    User Avatar
    Gold Member

    It maybe somewhat frustrating to learn from a textbook but this depends on various factors, like how much anyone likes programming so how much he/she is willing to spend time and efforts, how much time he/she has available, in what way he/she learns best and last but not least, if there is some time deadline like preparing for an exam or anything else. Although all these are quite understandable and more or less we've all been through similar conditions, the fact is that you can learn very well from a textbook, throwing enough code tinkering/experimenting and lots of problems and exercises into the mix and based on the procedure think - design - implement, with the design process being the most important, if you want to go way further. Now, you can of course learn by doing like Codecademy you mention but even this way, a textbook is again a precious guide otherwise you won't go anywhere beyond the basics. I would also suggest taking some online class for programming in any language you prefer - many mainstream languages are available, if you have the time to do so. Coursera is a good place to take a look at, edX is another one. I have taken lots of courses in Coursera in the past and I would even point you particularly to Programming Languages taught by the great Dan Grossman (University of Washington), if you want to learn the gist about functional programming concepts in the right way taught by an expert.

    I like Schaum's Outlines too and I have used Programming with C and Programming with C++ in the past, among others. They're really great in that they give the essential outline of the main concepts and have lots of exercises and problems, so I highly recommend them too.

    I also highly agree with what jim mcnamara says. Although not necessary to learn C first and then C++, it is good to do so if you want to get in the world of the C family of languages the right way. When you reach the point of good grasping of pointers and dynamic allocation of memory in general and some complex data structures, you can migrate to the C++ monster ?:)- talked in a good sense:wink:.
     
    Last edited: Feb 22, 2017
  6. Feb 22, 2017 #5
    Last edited by a moderator: May 8, 2017
  7. Feb 24, 2017 #6
    http://publications.gbdirect.co.uk/c_book/
    The explanations are good, and not too long. I think it has a good structure.

    You can find an even shorter intro to C here: http://cslibrary.stanford.edu/ ("Essential C") it doesn't have exercises though (use the book above for exercises?).
    What is even more interesting is the "pointers and memory" pdf, I think it's really good.

    Advice from someone who had both C and C++ courses: start with C, learn about object oriented programming, then start with C++, at least that worked for me.

    I hope these resources will help you!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted