Thread: learning c++

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    5

    learning c++

    hello.
    i have had a semester course in c and i wish to move upwards to c++ as well as to improve my skills and start making some programs (preferably gui programs). is there any book or website which can help me achieve this, preferably through practice and exercices?
    thank you in advance.

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    try the tutorial on this site first. Don't expect to make GUI programs for quite a while though.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I'd suggest Accelerated C++ as a book to follow. Especially if you're familiar with C. It is a little more accelerated which is good for those with previous programming experience. It also focuses on modern C++ practices rather than C style coding, which is good for someone who is used to C.

    If you just want to make programs, you could also stick with C and learn more of it. If you really want to make GUI programs quickly you can also try a different language that gets you to that point more quickly, like Java or C#.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    or even a dialect of basic like RealBasic or VisualBasic.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    5
    i didn't mean to bumb this thread, but i just wanted to say thanks.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    considering that your post was less than an hour after the first post in the thread, I think we'll understand.

  7. #7
    Beginner in C++
    Join Date
    Dec 2007
    Posts
    34
    Regarding Accelerated C++ (I'm working through it) it's best to read every chapter twice, but knowing some C you should be covered.

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Thinking In C++, by Bruce Eckel (available FREE online, or in hard-copy) is intended for people who already know C. It might be more advanced than Accelerated C++... and it's not really "accelerated"... It's kind-of "slow and detailed" with about 4x the page-count! (I don't own Accelerated C++, so I can't really compare the two books, but I can tell you that Accelerated C++ has an excellent reputation.)

    As you may already know, there is no graphics, color or mouse in Standard C or C++, so you need an additional library for GUI programing. (Your compiler probably includes a GUI library.) For Windows porgraming with the WinAPI, winprog.org has a good tutorial, and you can't go wrong with Petzold's book. Note that the WinAPI can be used with C or C++.

    ...it's best to read every chapter twice...
    Good advice for any technical book!
    Last edited by DougDbug; 01-07-2008 at 03:50 PM.

  9. #9
    Beginner in C++
    Join Date
    Dec 2007
    Posts
    34
    I'm nowhere near programming GUI yet, but what is the (there's probably more than one) graphics library for Linux? I'll partition my new laptop with Windows and Linux (Ubuntu), but will only use Windows for games so I'm going to tinker with Linux more.

  10. #10
    Registered User
    Join Date
    Nov 2007
    Posts
    8
    I'm curious too. It's hard to learn stuff reading the books. I had a class on C and it made me feel a lot more confident about it. Since I'm going into EE in school I might get by without taking a class in C++. I'll see if it feels good.

    SDL and OpenGL look pretty good to me. It looks almost like learning a new language though. Same logic, new I/O.

    Does SDL has enough for a GUI? I'm not sure.

  11. #11
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    I'll partition my new laptop with Windows and Linux (Ubuntu), but will only use Windows for games so I'm going to tinker with Linux more.
    that is exactly what I have now, laptop with windows and linux, windows only for gaming.

    what is the (there's probably more than one) graphics library for Linux?
    The most popular ones are GTK+ (used by GNOME) and Qt (used by KDE). They are both portable libraries that can be used on quite a few platforms (at least Linux, Windows, and Mac). Therefore, as an added bonus, your "Linux programs" will compile and run on Windows/Mac, too. IIRC Linux/UNIX used to have a native library called motif. It is pretty much abandoned now though, virtually everyone uses GTK+/Qt.

  12. #12
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    SDL and OpenGL look pretty good to me. It looks almost like learning a new language though. Same logic, new I/O.

    Does SDL has enough for a GUI? I'm not sure.
    SDL is not a graphics library in the traditional sense. It has a focus on game programming. eg (pseudo code)
    in a traditional graphics library you will be doing something like this
    Code:
    Window w;
    w.addButton(0,0);
    w.addLabel(5,5, "asdf");
    whereas in a library like SDL you will be doing something like this:
    Code:
    Window w;
    w.drawLine(x1, y1, x2, y2);
    w.drawCircle(x, y, radius, color);
    (none of this is actual code, but hope you get the idea)

    OpenGL is a 3D library, and you probably don't want to use it to draw GUIs.

    To draw GUIs, try libraries like Qt, WxWidget, GTKmm, or libraries specific to your platform (non-portable, not recommended).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Machine Learning with Lego Mindstorms
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-30-2009, 02:34 PM
  2. Best Approach for Learning
    By UCnLA in forum C Programming
    Replies: 5
    Last Post: 03-21-2008, 02:35 AM
  3. Need Help On a Simple Bank Program
    By oobootsy1 in forum C# Programming
    Replies: 9
    Last Post: 08-08-2005, 10:51 AM
  4. Learning Rate Of C++
    By Krak in forum C++ Programming
    Replies: 27
    Last Post: 01-29-2003, 01:53 PM