0.1 — Introduction to these tutorials


Welcome to the Learn C++ tutorials! Above all else, these tutorials aim to make learning C++ easy.

Unlike many other sites and books, these tutorials don’t assume you have any prior programming experience. We’ll teach you everything you need to know as you progress, with lots of examples along the way.

Whether you’re interested in learning C++ as a hobby or for professional development, you’re in the right place!

Tutorial structure

The tutorials in this introductory chapter are aimed at giving you some context around what C++ is, how it came about, how programs work, and what software you need to install to create your own programs. You’ll even write your own first program. Further chapters will explore different parts of the C++ language. In the first chapter (chapter 1), you’ll get a broad but shallow overview of many fundamental C++ concepts, so we can start writing some simple programs. Further chapters will explore those concepts in depth, or introduce new concepts.

Each chapter has a general theme, with all of the sections underneath it being related to that theme. There is no suggested amount of time that you should spend with each lesson or chapter; progress through the material at a pace that is comfortable for you.


Before we get started, lets hit on a couple of important goals of these tutorials:

  • Cover programming topics as well as C++. Traditional textbooks do a pretty good job of teaching the basics of a given programming language, but they often do not cover relevant programming topics that are incidental to the language. For example, books will omit sections on programming style, common pitfalls, debugging, good/bad programming practices, and testing. Consequently, by the time you finish the book, you understand how to program in a language, but you have a ton of bad habits that will come back to bite you later! One of the goals of these tutorials is to make sure that all of these incidental topics are covered along the way, in the sections where it naturally makes sense to discuss them. When you finish, you will not only know how to program in C++, you will know how NOT to program in C++, which is arguably as important.
  • Provide a lot of examples. Most people learn as much or more from following the examples as they do from reading the text. This tutorial will endeavor to provide plenty of clear, concise examples to show how to apply the concepts you are learning. We will also avoid (as much as possible) the twin evils: the magic hand wave (also known as …), where in the interest of space part of an example is omitted, and the unexplained new concept, where a new concept that is integral to the example is introduced without any mention of what it is or how it works. Both of these tend to lead to getting stuck.
  • Provide practice programs. The end of many lessons and sections will contain some exercises that you can attempt to answer on your own, along with solutions. You can compare your solution against ours to see what we did differently, or, if you get stuck, how we solved the problem. Then you can go back and refocus on the areas you need more work on.
  • Most importantly: have fun. Programming can be a lot of fun, and if you’re not generally having fun, you’re not in the right mindset to be programming. Tired or unhappy programmers make mistakes, and debugging code tends to take much longer than writing it correctly in the first place! Often you can save yourself some time by going to bed, getting a good night’s sleep, and coming back to a problem in the morning.

Getting the most out of these tutorials

As you go through these tutorials, we recommend a number of practices to maximize your learning experience:

  • Type in the examples by hand and compile them yourself. Do not copy and paste them! This will help you learn where you commonly make errors, as well as becoming familiar with compiler warnings and errors. As you type in the examples, think about why each of the things you are typing in make sense.
  • As you make mistakes or find bugs in your program, fix them. Try to solve your own problems before asking others for help.
  • Experiment with the examples. Change numbers and text to see what happens. Modify the programs to do additional things (e.g. if a program adds two numbers, make it add three numbers). Try to find different ways to break the programs (if a program asks for user input, try a variety of different inputs). You’ll learn as much from modifying the examples as you will by following them.
  • Write your own short programs using the concepts you have learned. Nothing is better than practice.
  • Learn to debug your programs when they don’t work. This is critical to solving your own problems, and is a skill that many new programmers skip to their detriment. We’ll have more information on how to do this in a future lesson.

Note: The majority of the examples in the tutorials are full programs that you can compile and run yourself. However, occasionally the examples will be “snippets” of code that are designed to quickly illustrate a concept. Because these aren’t full programs, they won’t compile without some additional work. You can turn these into full programs yourself, if you desire.

Is there a PDF version of this site available for offline viewing?

Unfortunately, there is not. The site is able to stay free for everyone because we’re ad-sponsored -- that model simply doesn’t work in PDF format. You are welcome to convert pages from this website into PDF (or any other) format for your own private use, so long as you do not distribute them.

These tutorials were written in 2007. Are they still relevant?

Yes, absolutely. C++ doesn’t change very often, and these tutorials have been largely kept up to date.

What should I do if I get stuck?

If you don’t understand something, read through the comments. Other readers may have encountered similar challenges. Second, try scanning through the next lesson in the series -- your question may be answered there. Third, use a search engine (we recommend Google) to see if your question (or error message) has been addressed elsewhere. Fourth, ask your question on a site that is designed for programming Q&A, like Stack Overflow.

If all else fails, skip the material you don’t understand, and come back to it when needed. You may find that something that was hard to understand is easier with the additional knowledge and context provided by other articles.

Alright, let’s get on with it!

0.2 -- Introduction to programming languages
No Previous Lesson

378 comments to 0.1 — Introduction to these tutorials

  • I am interested in computer and my age is 13. I like this course. I will read read each part everyday. I will help me to understand it easily and quickly

  • Yeyy

    Im gona start without any prior knowledge about coding language hope this helps...

  • Philip Dempster

    I must say... this first article is very inspiring! I'm taking an introductory programming class in C++ next semester and I'm a bit nervous, but I have faith that these tutorials will help pull me through πŸ˜€ Thank you so much!

  • I want to learn it.

    Want to program some softwares for my own web projects.

  • Leander

    This seems almost too good to be true. It's like you read my mind regarding the frustrations of using regular tutorials and guides. Looking forward to using these resources and donating eventually.

  • Hmm, it looks like I just hit the motherlode of C++ tutorials. Yay!

  • Gorador

    I'm gonna make a game

  • My dear Teacher,
    Please let me say I can't understand what is moved and where from 1.4c, 1.4d and 1.8a.
    With regards and friendship.

    • Alex

      I flipped the order of 1c and 1d.

      I moved the content about the std namespace out of 1.3a to 1.8a.
      I moved the content about using statements out of 1.3a to 4.3c.

      You shouldn't need to go back and re-read anything you've already read.

  • qalbe Ali

    very good site i really appreciate, it give us opportunities to be a good programmer.

  • Vai

    Looks like a good guide for someone who wants to learn how to program in C++ and learn good techniques along the way. Thanks for the tutorial. Hope to finish it all in 5-6 months!

  • Mr Alex,
    Please let me again express my sincere gratitude for your C++ tutorial, and make a comment.
    In the topic "Goals" > "Most importantly", you state "... to be programming". Because english is my second language, and besides learning cpp, I'm interested to improve my english, please permit me say that according to my english, you should write either "to be programmer" or "to do programming".

    • First and foremost, I want to say that I am not a professional linguist in any form, so if someone more qualified can give a better explanation, please do.

      That being said, OP's (Alex) grammar is correct. In the context that it is being used ("Programming can be a lot of fun, and if you’re not generally having fun, you’re not in the right mindset to be programming") "programming" is a verb in the present tense. It is similar to other present-tense verbs such as to " be driving" or " be jumping." Other acceptable ways to phrase it would be " program," " drive" or " jump." In those cases, the word in question (program, drive, jump) is being used as a noun instead of a verb.

      Like I said, this is probably not the most comprehensive explanation, but I just though I should try and help. Good luck πŸ™‚

      • Mr Layne Harris,
        Please accept my many thanks for you replied my comment and many more for your helpful linguistic information. It really improves my english.
        With regards and friendship.
        P.S. I'm Greek living in France. G.T.

  • dontletmegetme

    I'll see if it works, but it looks very promising.

  • Bm

    Great tutorials but a little hard to read. I would love to see a colour change or a dark theme introduced.

  • Vedansh

    Seems Intresting! I'll start right away!

  • Ashoka

    Thanks Alex for this wonderful site, Now I am re-starting to read and practice exercises in detail πŸ™‚

  • uay

    thanks for this site.. i will start!

  • UKImperium

    Great introduction. I'm really looking forward to getting into coding. I have a brother who learned himself how to code C/C++. He's been doing it for a few years now so lucky for me I'll have some help.

  • Nick

    Thanx for this tutorial, but i can't understand why you don't use "using namespace std;"? It makes the code shorter and increase the speed of coding. Isn't it?

  • Sammi

    Hey Alex!

    I've seen a lot of people commenting on how this is great for beginners, but what about people who have taken a few c++ programming classes in college but didn't quite learn everything?

    • Alex

      The tutorial series should definitely be good for those kinds of users too. I guarantee you'll learn something new. You can skim the stuff you already know well, and focus in on the topics you're weaker on.

  • Tsubaki

    Hi Alex,
    Is this tutorial up to date? I mean as a beginner, can I use it to learn C++ from scratch, considering that we're in August 2016?
    Because some people told me to be careful about where I start to learn C++ from, since a lot of tutorials are obsolete and C++ is changing every day!

    • Alex

      Yes, it's largely up to date. I'm still in the process of integrating some additional C++11/14 stuff into chapters 12 and beyond, but that shouldn't impede your progress or waste your time as the stuff that's there is still relevant.

  • Mal Jones

    Hi Alex,

    Do you have any plan to release a "paid for" version of the tutorial that could be used off-line?

    • Alex

      Not at this time. The content of this site gets updated several times a week, so an offline version would go stale pretty quickly.

  • SAAZ

    hi Alex, after am through with your tutorials, how do i implement it in writing windows programs?

    • Alex

      After you are through with these tutorials, in order to create Windows programs, you'll want to pick an appropriate GUI framework and leverage that. The framework will assist with creating windows and form elements, and the code you learn here will provide the logic that glues everything together. Which framework you choose is entirely your choice.

  • SAAZ

    Hi alex, is there any need for me to write any certification examination as a means to show that i am versatile in c++.

    • Alex

      I'm not sure what you mean. Can you restate what you're asking?

      • Ryan

        Hi Alex, Think what hes trying to ask is, Will he need to write and pass an exam so that he can show hes a certified C++ programmer like Java and the Sun exam.

        • Alex

          That depends on his employers requirements. Some employers like to see that kind of thing, especially if you have no work history or college degree. Otherwise, how do they know how well you understand this stuff?

  • easybtc

    Excellent.. i was just thinking in the morning to learn this programe to code some coin related games and if possible to develop a coins.. excellent.. now i got a good beginning...

  • Niko Gill

    This website is great! I love how much detail was put into it and that it does not require background knowledge of other programming languages to understand. Thank you! πŸ™‚

    • Alex

      That's the point of the site! To explain C++ in a way that doesn't require prior knowledge of anything except the English language and basic logic.

      • tzkang

        Haha,"Eecept the english language", I agree with it, because i am a Chinese, my english is poor. But I think this website is great.  
            I have learned something about C++ from "C++ Primer (5th Edition)",but I not good at C++ yet.
            I hope this website can help me to imporve my C++ skil as well as my english skill.

  • Sarah

    Hey Alex
    I started C++ course a month ago and I've been attending these classes, the teacher just lecture us about different stuff and programs and barely ask us to write things and then gives us some homework.

    I can't do those home works at all because I've never done programming, and I have no idea what's going on. Your tutorial is amazing but it can't help me since I can't spend much time on it.

    What do you suggest? How can I learn this?

    P.S: I"m very frustrated at the moment

    • Alex

      Given your time constraint, I suggest you read the lessons related to the topics your professor is covering to reinforce your knowledge.

      Outside of that, maybe get a tutor who can work with you 1:1 to maximize your time investment to output ratio.

  • Earnest Achayo

    Hello everyone, am a fresh beginner in learning programming and am looking for a programming friend who i can always ask some programming issues when i get stuck somewhere in between the coding lines please drop me a mail @ if you are one please. I will highly appreciate.

  • Hey Alex ! You're Awesome ! I'm very glad to finish this tutorial and very helpfull thank you for a lot !! πŸ™‚ i have a question , Can i translate this tutorial to my native language , with your permission ? πŸ™‚ Thank you so much again.

  • Brandon

    You are a scholar and a gent.  What is sad is I have gone to college (a bad one, but a college), purchase Udemy classes, paid tutors, and nothing has been as helpful as your site for the one factor, you break it down as though a child was learning this, provide tangible and practical examples.  You sir, are a light in our dark times of overpriced education.  Thank you for your generosity and for giving back to the community.

Leave a Comment

Put all code inside code tags: [code]your code here[/code]