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!

    Lesson structure

    The lessons 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 theme, with all of the sections underneath it being generally 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 may understand how to program in a language, but you might also have picked up 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. These tutorials 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. Don’t just transcribe the programs mindlessly -- think about what each of the lines you are typing in does, and how it contributes to the way the program functions. If you encounter anything that doesn’t make sense, or that you don’t understand, that’s something to investigate further.
    • As you make mistakes or find bugs in your programs, fix them. Try to solve your own problems before asking others for help. Learning how to find and fix errors is a key skill to successful programming. Don’t neglect learning how to use a debugger (we’ll explain how in a future lesson) -- it’s a key tool in figuring out where your programs are going wrong.
    • 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 more by modifying the examples than by simply following them.
    • Plan to spend some time with the quizzes. If you’re new to programming, you may find these challenging (and that’s normal, as your brain acclimates to the programming mindset). Don’t be discouraged if you don’t get the right answer the first time. You may need to try several different approaches before you find a path to success. It’s okay to look at the answer if you’re really stuck. Just make sure you understand how the provided answer works before proceeding.

    • Write your own short programs using the concepts you have learned. Nothing is better than practice.

    Common site-related questions

    Q: How do I sign up for the site? How do I get a login?

    All parts of this site are accessible anonymously -- therefore, no user account or signup is needed!

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

    Yes, absolutely.

    C++ doesn’t change very often, and when it does, the new content is largely additive. The tutorials have also been updated periodically based on language changes and reader feedback.

    Q: 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.

    Q: What should I do if I get stuck on a concept?

    If you don’t understand something:

    • Read through the comments. Other readers may have encountered similar challenges.
    • Scan through the next lesson in the series -- your question may be answered there.
    • Use a search engine to see if your question (or error message) has been addressed elsewhere.
    • 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 later. You may find that something that was hard to understand is easier with the additional knowledge and context provided by other articles.

    Q: What do I do if I forget what something means?

    Use the Site index. Look up any topics you want to know more about there, and you’ll find links to the lessons where that topic is discussed.

    Q: How do I get an avatar for the comment section?

    The comment section uses gravatars. You can create one on Click the “Create your own gravatar” button and sign up. Your gravatar will be connected to your (optionally provided) email address.

    Q: Can you do a dark mode for this site?

    Not easily, but you can! See

    Finally, one small nag: This site is free because it is ad-supported. If you find yourself enjoying the lessons, please consider disabling your ad blocker.

    Alright, let’s get on with it!

    0.2 -- Introduction to programming languages
    No previous lesson

488 comments to 0.1 — Introduction to these tutorials

  • Derek

    finally i found a friendly cpp tutorial

  • Vitaliy Sh.

    , you will not only know how to program in C++, you will know how NOT to program in C++,

    I'm curious: is that bug, or feature, that there is no "also" ("you will also know how NOT")?

    You’ll learn as much from modifying the examples as you will by following them.

    I'm curious, also: Is that possible to cut that sentence to "... as ... as by following them"?

    • Alex

      My understanding is that "also" is optional in this context. It doesn't seem to add much to the sentence.

      Yes, definitely possible. But I decided to rewrite the sentence a bit instead. Thanks for the suggestions!

  • Isitindarkrooms

    I just wanna say kudos for the darkreader note. I normally don't deal with extensions, but that ones a goody.

  • David D

    I studied C++ back in high school and before leaving my professor at the time made us take the C++ certification exam. Unfortunately since I never really engaged back in programming I actually forgot most of my C++ knowledge. It is such a joy to find this site so that I can refresh my knowledge and redo the experiment we use to do with the robots we built.

  • Wallace

    Is there a way to get notified by email if someone replies to my comments?

    Thanks for the great site!

  • Gnome

    I've used this website as a point of reference for the past 8 years of my life and to this day it is still relevant. This site will always be on my ad block trust list!

  • johannes

    Does this lesson teaches programing languages and it's meaning?

  • Parsa


    I've been spending a good amount of time on these tutorials and after talking with experienced programmers and people who use c++ and do programming as a job, I have been VERY demotivated, at the point where I think I might quit. Do you guys have anything to say?

    • It has always been fun for me. Of course there were times at which I got mad or frustrated, but I got over it. Programming isn't for everyone, a lot of people drop out.
      Start a project that you're genuinely interested in. I can't stress this enough. If you have an interesting project, you won't want to stop working on it. The hard part is coming up with an idea.
      You being demotivated tells me that you don't have an idea yet. If you really want to quit, please finish chapter 6. If you do that, you have at least seen the very basics of programming and should be able to understand basic code.
      Once you have a project idea, if ever, you can come back and learn the rest or learn an entirely different language.
      There's no point in finishing the lessons if you don't know you're after. You'll stop programming and forget half of what you learned.
      If you want to work with computers at some point, it's extremely useful to be a programmer. You need a program that does X? You write a program that does X! You want to automate Y? You automate Y! C++ isn't ideal for that, but if you know C++, you can learn a lot of other languages very fast.
      Do the things you enjoy. Don't learn programming because of a job.

      • Parsa

        Different people say different things and I've been searching for someone to start a project with me, but it's hard. Nobody I know personally knows how to program so I'm left searching for people to start a project with online (And that's where I met most of the people who have demotivated me) but yeah not very easy.

        I will definitely finish these tutorials and then I guess I'll figure out what I want to do from there.

        Thanks. Good to know there is at least someone out there who enjoys programming and c++.

  • Tuan Phan

    I have not bad experience with different languages but not much with C++. Now I need to revise C++ for future projects, and I found this website.

    What I have to do now is: A respectful bow to you.

    Your tutorial website is absolutely amazing.
    It 100% suits my study style especially when you recommend ppl to write code by themselves but not copy/paste; try to break program; and about mentioning common mistakes and what "NOT to", etc.

    Many many thanks!!

    PS: I have a feel that you are Russian. Sorry if that is not correct :)

  • Nina

    I used these tutorials to prepare for a college class. Amazing explanations and great examples! Thank you so much!

  • Yusuf najib Hussein

    I W'll learn c++ programing

  • Amrit

    Hi Alex,
    I must say that this tutorial is more than any one book can offer on c++. Plus, the style of writing, conciseness, examples are all so well written. I have forwarded these tutorials to anyone who approaches me. The standout point is that this is all free and that's a great humanitarian service that you have done to Earth. I just pray that this tutorial remain as long as c++ remains.


  • Phlier

    I disabled my ad blocker to help support the site, but even after doing so, no ads appeared. I know it's not much, but I sent a ten buck PayPal donation to Alex since apparently there is a problem with the site displaying ads right now.

    If you value the site, please consider making a donation to help keep the site alive.

    Thank you, Alex, for this invaluable tool to learn C++!

    • Alex

      Thanks for your support! Not sure why you're not seeing ads -- could be a temporary glitch, or something else is blocking them on your system. They seem fine to me.

  • Eggplant

    Seams to be great tutorial

  • Donald Frog

    Good experiences

  • AA

    Hello there,
    Would you create a new dark theme for this template of site ?
    My eyes hurt when I'm studying. Please, do this at the first time you can. It would be very useful.

  • Abayomi

    Please, what's the most appropriate software for learning c++? I'd like to download one.

  • Seth

    Im brand new in the world of coding, I know there is much to learn and this site is brilliant.  It's not often I read something that captivates me but you writing tone is very clear, easy to read and a big help and im sure this will be a great stepping stone into this world.  You should definitely put a reminder about addblockers I turned mine off but you should definitely let people know because a free resource like this is rare. ty.

  • Alireza

    Hey dude,
    I've learnt C++ (except multithreading) from other documents about 2 years ago.
    But Those contents were outdated. I want to know, Can I learn Modern C++ contests with reading this tutorial ?

    • Learncpp covers some features of C++11, but not 14, 17 and 20.
      If you already know C++, you can read through the list of changes in each version and apply them an an existing or new project.

      • Alireza

        I've surprised that why you don't cover features of C++ 17 and update these contests of tutorial to the last C++ version.
        If I know C++ 11, does it make problems for learning C++ 17 ?

        • Alex (Sole author and maintainer of learncpp) is working on updating the lessons.
          The more you know the easier it is to learn new versions of C++. New versions rarely change existing concepts, they just add new features.

  • mrsuit

    This walk-troughs is going to be great, I appreciate text based. It's pushing you away from being lazy what is the most important way if you want find anything useful in code, bugs, logs anywhere. Sorry for my Eng skill. I need more practicing but I just wanted to thank you for THIS site....

  • Aurme

    Hey Alex, I just wanted to leave a comment here about how you're able to keep this website free because of ad revenue. I would like to make a suggestion that you mention somewhere (possibly in the faq part mentioning the pdfs) adblocker, and request people to turn it off for your site if they are happy with the content you have provided.

    I am happy with this website, but I am so used to my adblocker that I forget that it is even there. It is only thanks to the mention of another person's comment I happened to read that I remembered I had mine on. I don't know how beneficial it would be to you, but I think it should be considered.

  • Nathan

    I know this was most likely answered before, but will I eventually learn how to create and code games with these tutorials?

    • No. These tutorials cover the basics of the language. You'll need them no matter what your goal is.
      If you want to get into games, you'll have to learn about rendering (OpenGL), threading and networking (sockets).

    • Ryder

      Hi Checkout my rep of learning c++ :

      I start with and right now I am playing with Unreal to further strengthen my skills in cpp programming.

      Although this website is not the best, but it push me to keep coding, which is more important for learning hard things like coding.

  • Jeffrey C Matthews

    Hi alex, I am very new to programming and when I mean new, I have no prior knowledge what so ever. I am currently taking a course in my college and were using the text book C++ learn by doing by Todd Breedlove and Randal Albert. How ever the complexity of this text is making learning this programming language very difficult. I am definitely the kind of person that learns easier by visual guides such as interactive video's or visual lectures. How ever, I was told that this source is one of the best for learning this programming language. So I may decide to start here. It seems like your guide is all text based, but I have to ask do you have any sort of interactive video's showcasing how each structure and part of the programming process works. Cause that would also be quite helpful if there were some video's I can download. Some times video's can help break things down to a bare fundamental logic with out all the jargon displayed in text books. I need almost a comparable "Programming for dummies" guide for me to really understand the process and concepts applied as its hard for me to ascertain exactly what is being represented in the current textbook I am using. Thank you,

    Jeff Matthews

  • devansh

    very useful post.

  • cristian

    great tutorials ...thanks from you shared with us :)
    great job i love youre tutorials

  • Steve

    Just started this course and reading your page, and I can't help but notice, you write great and have a captivating tone to teaching.  This site could easily make money if you charge for it, yet you keep it free.  I thank you for that and anticipate learning from the coursework you have provided.

  • Trần Lâm

    Oooooooooooooooooo. Update! Almost everything I have learned about C++ is thanks to all of you admins & your dedication in answering our (sometimes) ludicrous questions. I'm so glad I'm one of the first to come back here after update, and looking forward for more lessons.
    Like, regex.
    Hell, how funny it is.
    I keep writing it and compare to examples on and still don't know why i never get it right. And ohhhh thread. And next_permutation (whatever it is). And so many things I want to know.
    Of course i would figure them out after a while, but there's no other website explaining concepts as easily-absorbable-to-the-brain as you do.
    What I'm trying to say is,
    Thank you.
    And I greatly appreciate all the good knowledge you have shared to me and any other astute readers here.

  • Philip M.

    I wanted to cite something I remember reading here (at least, I think it was here) about the planning stages of programming, which works nicely for a point I want to make about how formal writing (as in writing essays and the like) can relate to my intended career of game development. However, since I don't see anything about this process on this page, and I don't have time to check the next several pages of lessons, I'll instead go with the tried-and-true approach of asking questions. Do you remember offhand what page this was, if I'm even thinking of the right tutorial site?
    It's ideal if I figure this out in the next 24-48 hours if possible, as I want to cite it in something for college that is due tomorrow. That said, it's far from the end of the world if I can't figure it out by then, since the "something" is only worth half a point and should stand on its own well enough without citation. Thanks for any help you can provide, regardless!
    Phillip "Twisted" M.

    • Alex

      If it was on this site, most likely from lesson 0.4 or 1.10b.

      • Philip M.

        I'll check. Probably wasn't from 1.10b, as I didn't get that far before I had to change focus for college, but it might be from .4. I'll be sure to credit you if I reference it. Thanks again!
        edit: confirmed by a skim read, that is definitely the lesson I was looking for. "Introduction to development" describes the various steps of the development process (the part I was looking for), as well as explaining some basic things like the difference between linking and compiling

Leave a Comment

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