Search

0.1 — Introduction to these tutorials

Welcome!

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

Goals

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. 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 as much from modifying the examples as you will by 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 you acclimate your brain 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 way forward that works. It’s okay to look at the answer if you’re really stuck. Just make sure you understand how the 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: 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: These tutorials were written in 2007. Are they still relevant?

Yes, absolutely.

C++ doesn’t change very often, and these tutorials have been updated to accommodate new content and language changes.

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. Second, try scanning through the next lesson in the series -- your question may be answered there. Third, use a search engine 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 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 a login for this site? How do I get an avatar for the comment section?

All parts of this site are accessible anonymously -- therefore, no user account or signup is needed. The comment section uses gravatars. You can create one on gravatar.com. Click the “Create your own gravatar” button and sign up. Your gravatar will be connected to your (optionally provided) email address.

Alright, let’s get on with it!

0.2 -- Introduction to programming languages
Index
No Previous Lesson

405 comments to 0.1 — Introduction to these tutorials

  • 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 cplusplus.com 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.

    • Alex

      Thanks for the feedback! I'm super excited to write more lessons, but I'm also torn between writing new material and refining what exists today to make it better for new readers. In practice, I hope to do a bit of both!

      As an aside, this site has no admins. Nascardriver and everyone else who responds are doing so because they want to, and I am super grateful for that.

  • Philip M.

    Alex,
    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!
    Thanks,
    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]