Like Tree4Likes

Learning C++ and C at the same time

This is a discussion on Learning C++ and C at the same time within the C++ Programming forums, part of the General Programming Boards category; So I'm learning C at the moment but I would really love to learn C++ as well. Especially since I'd ...

  1. #1
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88

    Learning C++ and C at the same time

    So I'm learning C at the moment but I would really love to learn C++ as well. Especially since I'd like to go into games programming and explore the different programming paradigms that C++ has.

    Do you guys recommend learning C++ while I'm learning C? I've been looking at one day C, the next day C++ and so on from Monday to Saturday So each language gets 3 days in the week. Sundays its Linux and Python.

    Any opinions and if so any book recommendations on what to start with.

    Thanks,

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,681
    I first learned C. Then I learned C++. And that's it what I recommend. Notice, that game programming has to do with C++ mostly.

    However, learning is a never ending process
    hex_dump likes this.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    Quote Originally Posted by hex_dump
    Do you guys recommend learning C++ while I'm learning C?
    If you don't have a programming background, NO. Learn one language first as a key to unlock the skills of problem solving with programming. If you already can program, then sure.

    Quote Originally Posted by hex_dump
    any book recommendations on what to start with
    Accelerated C++
    King Mir likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,602
    Quote Originally Posted by std10093 View Post
    I first learned C. Then I learned C++. And that's it what I recommend.
    Learn C as a precursor to C++ is not recommended...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    Quote Originally Posted by laserlight View Post
    If you don't have a programming background, NO. Learn one language first as a key to unlock the skills of problem solving with programming. If you already can program, then sure.


    Accelerated C++
    Thanks for the input guys. I think I wil learn them in tandem then.
    Laserlight I saw and heard a lot about this book, but looking in it I noitced he doesn't use the
    Code:
     using namespace std;
    convention. I'm obviously not familiar with C++ but I thought that was a no-no so I decided against it. Should I use it still? I thought I would start with C++ By Dissection by Ira Pohl. Any advice would be really helpful.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    Quote Originally Posted by Elysia View Post
    Learn C as a precursor to C++ is not recommended...
    Agreed. However, I don't think that this is the intent of the OP. If you intend to eventually move on to C++, then it makes more sense to start with C++. C is essentially a subset of C++ (it's a little more complicated than that, but for the purposes of this discussion it's close enough), so if you know C++, C will come naturally.

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    Quote Originally Posted by hex_dump
    I saw and heard a lot about this book, but looking in it I noitced he doesn't use the
    Code:
    using namespace std;
    convention. I'm obviously not familiar with C++ but I thought that was a no-no so I decided against it.
    Checking the book, yes, it only introduces using declarations, not using directives, but the step from understanding a using declaration to understanding a using directive is a trivial one. Furthermore, you are mistaken to think that there is such a convention, and in fact code that has such a using directive indiscriminately placed is a no-no as it can do things like allow name collisions or change the meaning of code.

    Quote Originally Posted by hex_dump
    Should I use it still?
    I would not have suggested it if I thought otherwise.

    Quote Originally Posted by hex_dump
    I thought I would start with C++ By Dissection by Ira Pohl.
    I have never read that book, or even heard of it, so I cannot really say yes or no. However, searching the Web, I find that one of the exercises in the book apparently asks the reader to "derive an integer vector class from the STL class vector<int>". This is troubling because deriving (as in public inheritance) from a std::vector is usually a wrong approach: in this case, it would be better to extend the interface of std::vector<int> with non-member functions that do the job.
    hex_dump likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,257
    I'm obviously not familiar with C++ but I thought that was a no-no so I decided against it. Should I use it still? I thought I would start with C++ By Dissection by Ira Pohl.
    O_o

    Yes.

    Why study under Vincent van Gogh when Cecilia Gimenez is available!?

    C is essentially a subset of C++ (it's a little more complicated than that, but for the purposes of this discussion it's close enough), so if you know C++, C will come naturally.
    O_o

    What comes naturally is the underlying science fortified through learning the foundations of programming which is necessarily obtained in learning one language.

    The language itself is a different beast. If you've only ever used C++, you maybe know the syntax of C, but that is all. You do not know the sins of the language. You can not write good, clean, canonical code in C without spending effort learning and practicing C. Many of the sins of C will be repellant to a C++ programmer; these things will very definitely not come naturally.

    The same is true for every other language regardless of relationship.

    So, yeah, implying to this guy, or anyone else, that C will "come naturally" to a C++ programmer is just a foolish as saying the opposite.

    Anyone who says different is lying and very likely trying to sell you a book.

    And before it comes up: simply using a language to do a job is an entirely different beast from what was implied. You can glue your way through to using any language even with no familiarity, but that isn't the same thing at all as "coming naturally" is it?

    Soma

  9. #9
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    Excellent, Accelerated C++ it is then. Thanks a bunch people!

  10. #10
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,681
    Wait! I recommend first taking a look at the relevant thread about books.

    I have never read the book the others suggest, but I think that it would be nice for you to check other options too
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    2,032
    If you're looking to learn C, C++, and Python like you seems to be saying, then I suggest starting with Python, and getting a good book on it. Once you're comfortable and have written a few things in Python, then go on to C++. Lastly go on to C. Python is a good starting language. C++ is more used than C, particularly in desktop programming, so learn it earlier. Also, there are fewer good C++ practices that are bad C practices, than the other way around.

    As laserlight says, with no programming background, you should not try learning three languages at once. Learning C and C++ at the same time can be confusing too, because the languages are so similar, but have different approaches to programming. Still, if you want to diversify your activity at that point, I suppose you could learn Java or C# at the same time as C++, or for something completely different Haskell or Lisp.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  12. #12
    Registered User
    Join Date
    Jun 2005
    Posts
    6,290
    Quote Originally Posted by King Mir View Post
    Also, there are fewer good C++ practices that are bad C practices, than the other way around.
    There is, however, a considerable number of good C++ practices that cannot even be used in C. And a considerable number of C++ practices that require considerable adaptation to be used in C.

    Quote Originally Posted by King Mir View Post
    As laserlight says, with no programming background, you should not try learning three languages at once.
    For most people, I agree with laserlight, although I would substitute "two" for "three".

    A person with very strong theoretical and conceptual abilities could get away with learning more than one language without previous background. I know one guy who learned polish and russian (which are two languages with differences, but also significant similarities) in parallel classes over two years (and is currently fluent in about fifteen diverse languages, and working professionally as an interpreter). However, such people are rare, often quite arrogant about their abilities, and often not interested in programming for practical reasons.

    Given the language similarities between C and C++, it would be possible to learn significant parts of both languages together. The difficulty would be orchestrating the learning (or, more precisely, the teaching) in order to ensure the student learns both languages while ensuring they can keep track of the differences - otherwise the result will be a student who learns some mixed hybrid mess of the two languages. I'm not aware of any teacher (or textbook) that has successfully achieved that.

    Pending such an approach, I would suggest learning C or C++ first (it doesn't really matter which comes first - pick the one that is better suited to the type of work you wish to do, or pick with the help of a coin). Then transition - with all of the "unlearning and relearning" that entails - to the other language. The problem is picking when to make the transition. Students invariably over-estimate their proficiency in new skills, and will therefore naturally think they are ready to make the transition before they really are. People with strong experience (both theoretical and practical) in both languages are probably best placed to judge when a student is actually ready but students will still invariably become over-confident, ignore such advice, and then have to learn by making mistakes.
    Right 98% of the time, and don't care about the other 3%.

  13. #13
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,602
    Quote Originally Posted by hex_dump View Post
    Excellent, Accelerated C++ it is then. Thanks a bunch people!
    Also, this book.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    Registered User
    Join Date
    Apr 2006
    Posts
    2,032
    Yeah, I would not say that it's impossible to learn languages in any order conceivable. Just that it's not worth trying. Learn Python first, then C++ then, C.

    As for knowing when you're ready to move on, my advice is, A, get through a book, and do the exercises throughout, and, B, to have a culminating project, on the scale of an online game that practices those skills.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  15. #15
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    Quote Originally Posted by Elysia View Post
    Also, this book.
    Quote Originally Posted by King Mir View Post
    Yeah, I would not say that it's impossible to learn languages in any order conceivable. Just that it's not worth trying. Learn Python first, then C++ then, C.

    As for knowing when you're ready to move on, my advice is, A, get through a book, and do the exercises throughout, and, B, to have a culminating project, on the scale of an online game that practices those skills.
    Yeah i think an online game is what im heading for. Games just seem to touch on everything. Thanks for the advice.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning two programming languages at the same time
    By BIOS in forum General Discussions
    Replies: 10
    Last Post: 10-04-2011, 04:08 PM
  2. [HELP] Code to Convert Army Time to Normal Time?
    By Kipper DeVera in forum C++ Programming
    Replies: 9
    Last Post: 08-21-2011, 11:50 PM
  3. Replies: 7
    Last Post: 11-21-2009, 12:02 AM
  4. Learning Dos and learning Windows
    By blankstare77 in forum C++ Programming
    Replies: 8
    Last Post: 07-31-2005, 03:48 PM
  5. API learning reference (for those who are learning)
    By steve_i83 in forum Windows Programming
    Replies: 1
    Last Post: 11-04-2001, 12:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21