LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to learn c++? (https://www.linuxquestions.org/questions/linux-general-1/how-to-learn-c-672833/)

jmite 09-28-2008 12:28 AM

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!

pinniped 09-28-2008 01:43 AM

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.

ErV 09-28-2008 06:17 AM

Quote:

Originally Posted by jmite (Post 3293880)
How to learn c++?

How to learn C++ or any other programming language:
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.

pinniped 09-28-2008 07:01 AM

Quote:

Originally Posted by ErV (Post 3294052)
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.

I wouldn't agree entirely with that - there are numerous truly awful books about C, C++, algorithms ... so it's always good to have a recommendation from someone who knows what they're talking about. Some of these books are so bad, it's difficult to resist the temptation to tear them up when I see them in book stores.

almatic 09-28-2008 07:41 AM

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.

H_TeXMeX_H 09-28-2008 08:15 AM

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.

elprawn 09-28-2008 08:42 AM

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.

justmovedtolinux 10-02-2008 04:21 AM

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

Linuxmaster001 10-02-2008 04:53 AM

i found a very nice book called "c in a nutshell", try that one

Linux Archive

ErV 10-02-2008 10:14 AM

Quote:

Originally Posted by pinniped (Post 3294077)
I wouldn't agree entirely with that - there are numerous truly awful books about C, C++, algorithms ... so it's always good to have a recommendation from someone who knows what they're talking about. Some of these books are so bad, it's difficult to resist the temptation to tear them up when I see them in book stores.

I meant that finding one "good enough" book is better idea than wasting your time(probably weeks) reading flamewars about "which book is the best" or accumulating library (having many books on C++ doesn't automatically mean you can program). The first priority of anyone who wants to learn language is to start with _anything_ - just to see if language is good to you and you really have the will to learn it. When I was learning C++, I had been using one of Bjarne Stroustrup's books.

loperz7 10-03-2008 05:19 PM

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.