Thread: Trying to Learn C++, Finding it Difficult...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    8

    Trying to Learn C++, Finding it Difficult...

    I am trying to get a better grasp of C++. I've written a few very small apps in C++ (school assignments) but I am in an interesting position. I have experience programming and I've created a few client/server apps in C# (visualization app) but when I want to learn something new.. I usually buy a book (Accelerated C++) and I get bored in the first 4-5 chapters and I can never finish it.

    I need a book that is more targeted towards advanced users maybe? But I don't know of one. I need something that's like ok, this does this and this does this and just gives me everything real quick and dirty. I need more advanced topics introduced to me.

    Essentially the problem is I don't know where to start because learning about variables, loops, string literals etc. bore me because I've read about them so many times.

  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by SkinnyK
    I get bored in the first 4-5 chapters and I can never finish it.
    You won't get bored if you write interesting programs at the same time.
    Just Open the book once in a while, reading a chapter or two at a time ...and you'd soon find it difficult to get bored !
    Last edited by manasij7479; 08-31-2011 at 06:55 PM.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Location
    Montreal, Quebec, Canada
    Posts
    73
    There are "C++ for <insert language> programmers" on the internet which will present you with the differences and similarities of those two languages.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by SkinnyK View Post
    I've created a few client/server apps in C#
    then C++ should be pretty simple for you. the syntax is almost exactly the same. there's just a few new rules you need to learn. a few of them are:

    • there is no built in garbage collection. you have to destroy dynamically allocated objects yourself, but objects created on the stack have a clearly defined lifetime.
    • any numeric value can be implicitly converted to a bool.
    • a string literal is not the same as a string object. string literals are represented as const char arrays.
    • global functions and data are permitted, and are not required to be within a class or namespace. in fact, the main() function must be in the global scope, in the absence of a "using namespace" or "using <namespace>::main" directive.
    • your main function's signature is:
      Code:
      int main(int argc, char **argv)
      
      or
      
      int main(void)
      there are no exceptions to this in standard C++.


    I hope this gets you headed in the right direction.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You refer to the simple things that you are bored of ("variables, loops, string literals") but you not do mention what you would consider to be an "advanced topic". If an advanced topic is templates or the STL or classes/object oriented programming, then I am sure the book you mentioned or any book on C++ you can find at the school library will address these in depth.

    If templates and OOP are also "boring" because you've mastered them, I'm a little confused: you therefore essentially now know C++, so whatever it is that you want to learn is not really language specific. You mentioned network programming. Have you tried writing a client/server in C++? If not, maybe you should. You could even try to literally translate your C# code into C++. I've done things like that when learning a new language; as long as you are not going for too literal a translation and are careful to consider the differences between languages and what those imply in terms of design, it can be enlightening.

    But, nb, if templates and classes and the STL are something you have not bothered with because they seem like simple boring topics, then you are kidding yourself. Learning to walk may not be as exciting as rock climbing, but I guarantee that you do need to actually do it first.

    The other suggestion I have is that you look into the Boost C++ libraries. There is probably something there to interest any programmer and you will learn some C++ nomenclature and methodologies in the process:

    http://www.boost.org/
    Last edited by MK27; 09-01-2011 at 07:26 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    8
    Thanks for all the tips and information guys, I'll be taking a look at boost.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How Difficult is This?
    By MAtkins in forum C Programming
    Replies: 43
    Last Post: 02-11-2011, 02:21 PM
  2. Really Difficult Debug
    By Delta_Echo in forum C++ Programming
    Replies: 5
    Last Post: 07-25-2008, 08:35 PM
  3. Difficult Triangles
    By Shakermaker in forum C Programming
    Replies: 3
    Last Post: 12-10-2007, 06:24 AM
  4. what is more difficult to learn than c programming
    By polymorph in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 10-22-2002, 10:10 AM
  5. why must everything be so difficult!
    By ... in forum C++ Programming
    Replies: 14
    Last Post: 03-22-2002, 04:21 PM