C++ as a first language

I have seen some comments on this forum as to the difficulty of starting C++ as a first programming language.

Is there a better language to start with?

I have failed my first semester of C++ and would like to be better informed/prepared when I approach the course again. My particular learning environment was an online classroom with an instructor that was, although HIGHLY qualified, more like a facilitator in a self-learning atmosphere. There was a textbook (Problem Solving with C++, Walter Savitch) some outlines and power point presentations and the rest was up to us. When it comes time, I will have the option of traditional classroom/lab setting for 16 weeks or to retake the class online in the six-week format I described above.


Also, I would like some feedback on what has been everyone's experience in their learning process. Traditional classroom, self-teaching, online tutorials. What were your successes and failures?
Is there a better language to start with?
Excluding esoteric languages, it's hard to come up with a language that's a worse first language than C++. C and C++ are very complex languages that require deep knowledge about how computers work to fully understand and master. Basically, everything a beginner programmer shouldn't worry about, these languages shove into your face.
As a first language I would recommend anything that abstracts resource management, is interpreted (although that's more of an implementation thing), has a simple syntax, and preferably is object oriented. Maybe take a look at Python?
Last edited on
Thank you, helios. I am somewhat of a late bloomer when it comes to programming, but I am definitely hooked and would like to see myself getting into it for serious.
Then again, you could argue that it's the requirements of this deep knowledge of how computers work that pushes your knowledge of computers forward. Whilst you're trying to grasp how C++ works, you're simultaneously increasing the drop box of "computer crap" in your brain. I enrolled in a Computer Repair class at a University, and I'm top of the class without even really putting out an effort yet.

C++ Was the first language I learned (i'm 15). I can really give the credit to most of my knowledge to the fact that i decided to learn it. On top of that, it really helps you in math. Being able to think computationally makes things make sense much faster.

Of course, C++ has its kinks, and still things that I don't understand, but because i did it first, everything else seems easy. Sort of like ripping off a band-aid really fast, sucks like hell for a few, but pays off.

And i can relate to you having to learn straight from text books, I didn't have any other option. I'm 100% self-taught, as of 2 weeks ago; then i joined this forum and everyone helps out :P
I disagree with the anti-C++ sentiment.

C++ is a perfectly good, useful language to use for learning to program. It has all the basic features you can find in any other imperative or object-oriented language.


Learning to program really has very little to do with the choice of language. Granted, some languages are particularly suited to learning to program, such as Python and Pascal. But learning to think about what you are doing is more important than the choice of language. Learning how a computer works and how to express your thoughts in terms that the computer can work with is the goal -- not learning <some random programming language>.

No matter what choice of language, you must accept some boilerplate at face value when you start. In C++ that includes things like the funny int main( int argc, char** argv ). When the time is right, you'll learn what they really mean and how to use them properly, but until then you don't need to worry about it. Just take one step at a time.


Don't be discouraged. It (usually) does not matter what language you chose to start with, as long as you like it. It does take some time, however, to wrap your brain around some of the basics of computer programming -- just as it does in any other discipline. When you do, it is a great feeling and you'll be hooked.

Hope this helps.
I never felt that C++ was much harder than other languages I've tried out. I am fairly new to the language myself and because I have given the book I'm learning from away, I'm in a C++ withdraw when it comes to new practices.

Anyway, C++ is fine for a first language in my opinion. I dabbled in Ruby and Python before heading into C++ but other than being aware of different programming techniques and functions, it never felt that much different in the learning experience.

If you want to learn to program as a career, C++ is probably going to become your standard or one of your preferred languages eventually, so learning it first won't hurt. I particularly like Thumper's analogy:

Sort of like ripping off a band-aid really fast, sucks like hell for a few, but pays off.


If you are going to go back then maybe reading through some tutorials off the interwebs or picking up an extra curricular book would do you some good. As for learning another language first, it doesn't seem like a necessary thing to do.
I respectfully disagree.

Perhaps I am not so smart, but IMHO, C++ is at least a magnitude more difficult than than a random language X that I pick. When I say more difficult, I mean:

- more difficult to master: due to the multi-paradigm nature of C++. After playing with C++ for a decade, I do not feel that I'm anywhere close to mastering the language. That's not true of other languages, at least for me.

- easier to be "surprised": the richness of features, plus the non-orthogonal nature between those features causes surprises to show up more often than not.

- need to understand the implementation of the C++ compiler or even library implementation details (like stl) to use a feature properly: this occurs quite often in C++ but rarely in Java.

In fact, entire books can be written about a single feature of C++ (stl, iostreams, generic programming, OOP, design patterns and anti-patterns, etc...)

Having said that, I do agree with the sentiment that the more I learn about C++, the more I understand how compilers and software works. C++ follows the spirit of C in the sense that it assumes the programmer knows what he/she is doing - that gives the developer a great deal of power, but also the opportunity to blow things up.

Despite all this, C++ is still my main weapon of choice, for its efficiency and for its OOP/template features. C++ essentially lets me do what I want to do. However, I am always on the lookout for new alternatives (perhaps D or Go are good bets).

Oh, and in answer to the OP's question, yes, for me, personally, doing Smalltalk before C++ helped me grasp OOP in a deeper sense more quickly. Doing C and a little ASM before C++ helped me with pointers. YMMV.

Helios' recommendation of Python +1. If you are going the path of scripting languages, Ruby is also excellent. It all depends on what kinds of problems you were having with C++.

As for doing better in your second iteration of C++, make sure you program in C++ as much as you can: read and talk to experienced programmers so you understand the concepts, but nothing sinks in like actually sitting down in front of a keyboard and going though the coding/testing/debugging cycle.
Last edited on
There is a difference between learning to program using a specific language and mastering said language.
I agree with the above comments: C++ as a first language is hard at the beginning, but pays off in the end. However I do feel that it's a good thing to have some programming experience. For example, when I started to learn C++ I just had some HTML, CSS and Java (not JavaScript) experience. The HTML and CSS experience probably didn't really help at all, but the slight experience of Java made a world of difference. I didn't have to get a grasp of concepts like variables, types, functions and operations anymore, since Java has those things as well.

However, since Java does things differently from C++, you will never understand the aforementioned concepts fully from a C++ point of view if you don't do them in C++.

Look at it this way: C++ will take you down a gritty, harsh dirt-road while a language like Python has it's path smoothed and paved out for you. The Python path will lead to a nice lake-side mansion with beautiful views, but the C++ path will take you a magical world of wonder where you are a god.

So I suggest you put in some additional effort to start with, as it will pay off afterwards. I suggest you make C++ your first language.
closed account (Lv0f92yv)
I agree with Duoas -
learning to think about what you are doing is more important than the choice of language. Learning how a computer works and how to express your thoughts in terms that the computer can work with is the goal -- not learning <some random programming language>.


This is more important - and frankly, after syntax and the semantics of the language are figured out, the problem solving techniques become far more relevant (and exciting).

With this said, C++ is considered a 'hard-for-beginner' language (by some) because it has some lower level features (closer to memory management) that if delved into too soon, will tend to disorient people.

As Duoas mentioned, C++ has the basics that can be used from day one to build simple programs where worrying about some of that lower level stuff is not important.

The only area where I would suggest to go with something like Java is when learning arrays. I say this only because if exceptions (NullPointerException)s are thrown when you access memory that isn't yours in a java program, you know exactly where to look. This saves some aggravation a beginner programmer might not want to deal with.

Java also has a much larger standard library, which makes creating GUIs and graphics based programs quicker in many instances than in C++ building them from scratch (though there ARE libs for C++ that help with this). If your'r someone who needs the GUI style programs to keep you interested while learning, then Java might be a good option.

In my own experience, I taught myself C++ before Java or PHP, and found both those languages MUCH easier to pick up after. I agree with Rycul in that C++ is a good first language - with the addendum that you are willing to spend time in the beginning getting frustrated with strange compiler errors and long debugging periods, with the long term goal of improving your problem solving skills via code.

Last edited on
Having read all these reply's about c++ and of course being a newby trying to learn programming myself, I find it hard as well but I also like the challenge of learning something new. I found myself fumbling at the start but the more that I do the more that I understand
and I am so glad that there are these forums where you can find people that have this vast amount of experience and are more than willing to share with you and help out with even the most trivial problems. If there is anyone out there that might have any pointers or basic programs that I can try and check to see how they work that would be great.
I am doing the c++ tutorial and expecting that it will probably take me a while to get through it and the code::blocks as well.
Oh and thanks to Mottman for the advice.
Thank you so much, everyone. You have all been helpful in sharing your knowledge and experience. I have three semesters of required C++, so I will eventually have to "face the giant", but for now, I think I will self-study, do a little lurking and possibly a little posting as well. You are a great group of people.
Last edited on
Here is a great list of exercises to try out catering to a wide variety of knowledge levels: http://www.cplusplus.com/forum/articles/12974/

As for actual source on small programs, checking around the beginner section here won't hurt as following a problem to seeing the solution could be good practice to see if you can catch other people's/your own problems. There is sourceforge.net but most/all of the source there is very advanced and probably won't help you understand but instead scare you (I know it scared me).
My perspective on this is a little different. It depends a great deal on the personality type you are. My personality type is that if I don't understand something, it bugs me till I keep reading more about it and understand it better.

My first contact with programming languages was visual basic. I found it reasonably interesting but after a while it became boring exactly because visual basic hides a lot of base level stuff. The questions keep popping up and eventually I got frustrated with it.

I was initially discouraged from taking up C++ because I was under the impression that it is a difficult language. But being frustrated with visual basic I decided to try it any way. I was pleasantly surprised. Yes, C++ brings you closer to the machine and does bring you close to machine concepts that a newbie need not necessarily know, but for a personality type such as mine that was the beauty of it.

Though difficult to understand at times, for me at least, it was ultimately satisfying to understand concepts like the stack, memory addresses, pointers etc. A lot of these concepts didn't become clear at first read. The trick is to keep reading again until the concept becomes more clear. Add to this you have to test the concepts that you learned by writing simple code whenever you can. I have always found it funny that every time I go back and read about a concept I thought I knew about I always seem to learn something new.

To answer the Op's question, in summary, I would say the answer largely depends on your personality type. I say give all the most commonly used languages a shot. Out of that whichever language YOU find most interesting and/or useful, stick to that for starters. Then move on to the rest. For me that language was C++. (Nowadays I also dabble in php)To others it will be different.
Last edited on
JimNewbie +1
Thanks Duoas :)
closed account (3hM2Nwbp)
I've always looked at this question differently than most people. In my personal experience, the concept of programming isn't related to any specific language. It's a way of thinking that can be expressed in an infinite number of ways (IE pseudo-code or any of the multitudes of programming languages available - or even in business structure!). For expressing our thinking process, we have these tools called computers that help us to achieve our idea's goal. A specific language is an abstract link between our ideas and what actually needs to happen to execute that idea.

This brings up a three distinct areas that should be focused on while choosing a language:

A) How well do you know your tool (computer)?

C++ is a language that allows extreme flexibility with the machine the code is running on. If one understands how the machine works at a very low level, then the concepts applied in the language will not be completely foreign to him or her, and should be used quite easily. On the other hand, if one is not as educated in the under-the-hood parts of their computer, then I would think that a language that hides those things would be a good start, like Visual Basic.


B) How well do you understand your thinking process?

This is (in my opinion) the most important question. This can be related to the structure of the (pseudo)code, ironing out all possible sources of error, and finding the most efficient solution. There are too many 'bad' - and I use the term strongly - practices floating around on the internet these days. I don't mean to put anyone down, I've come up with a whole wheelbarrow full of bad ideas since I started programming, I'm sure everyone has.


C) How well do you know the syntax of the choice language?

This, unfortunately, (in my opinion) can only come with blood, sweat, tears, and caffeine. Swearing, cursing, throwing wrenches, and insomnia will come later.

Message boards such as this one help tremendously as well.
Last edited on
Topic archived. No new replies allowed.