How to learn c++?
So, I'm looking into getting into programming for linux, especially making KDE GUIs to cli programs. And KDE uses C++. I know NOTHING about programming.
What I'm wondering is how I should go about learning these languages, if I should learn C then move into C++, or C#, or something? Are there any programs for linux which act as educational aides for teaching programming languages? Thanks! |
C and C++ are different enough that you should find a good book on C++ (I can't think of any I'd recommend). If you learn C first you'll probably be programming in C for C++ and missing out on features of the language.
As you learn, have a look at the code for the simplest KDE programs you can find and move onto more complicated things as you learn to understand the code. |
Quote:
1) Get an software idea you'd like to implement. Game, joke program, application. Must be important for you. Idea == motivation. No motivation == less chances to learn. 2) Get a book about that language. ANY book. When in doubt which one - do a google search, and pick any one people recommend somewhere. Start learning from book. Write a lot of small programs. You should have fun in the process. NO fun == no interest. No interest == less chances to learn. 3) When the book is over, try another one or re-read current one. 4) When you can't get more info from books, analyze existing code made by other people, and keep writing your own programs until you are comfortable with language concepts and understand them by heart. 5) Done. Things to be avoided in process: 1) Do NOT seek "the best" book, this is waste of time. Pick any recent book, because they mostly share same knowledge. If you have to learn, read ANY book. If you want "the best book", then you obviously don't want to learn. 2) Do NOT seek "the best" language, this is also waste of time. Pick any one you like (and comfortable with) and learn it. Do a google search when in doubt. In general all language are similar, so if you know how to code in C++, you'll be able to switch to java, C, python, php and many others, although it'll take a bit of time to learn syntaxic differences and new library functions. Asking in forums "which languages is best for you" is pointless - no one knows, you have to find it yourself. |
Quote:
|
For kde guis, you might also want to take a look at kommander (http://kommander.kdewebdev.org/). It's a modified qt-designer, which lets you create full featured guis and fill the widgets functionality with bash code and some simple commands. No big programming knowledge necessary, but still very powerful.
Other than that, the kdelibs have bindings for many languages, so you won't necessarily need c++ for creating guis. |
A book will definitely help, then just make some programs based on some FLOSS programs. However, do take note that C and C++ are notoriously difficult languages to learn, if you've never done any programming whatsoever before, then you will likely quit early if you start with these. I say try python or another easy interpreted language, maybe ruby, some prefer perl, then move on to learning C and C++. If you want to go through the pain, go ahead and start with C or C++, but be prepared.
|
Get a good grasp of conventional programming and OOP in general and that'll make learning C++ easier. Other than that you just need to learn the syntax and the libraries.
|
If you want to learn C++ - you can buy the book called "Computer Science C++" by "Sumita Arora"
If you want to learn C - check out "The C Programming Language" by "Brian Kernighan and Dennis Ritchie". The book is slightly advanced, but if you learn from it - its pretty much guaranteed that you'll be a master of the language! I've used it during my school/college days. It teaches you the language in a simple and easy to understand manner. :) Linux Archive |
|
Quote:
|
First buy a beginners book to programming which isn't geared towards certain programming language - they should teach you about loops and variables and what not. From there you can move on to a book about C++.
I learned via Pascal but that isn't needed by any means since the best lessons I had were via pseudo code which made programming easier to understand. Debian |
All times are GMT -5. The time now is 08:50 PM. |