Search

C.1 — The end?

Congratulations! You made it all the way through the tutorials! Take a moment and give yourself a well-deserved (insert something you enjoy here).

Now, after breathing a long sigh of relief, you’re probably asking the question, “What next?”.

What next?

By this point, you should have a solid understanding of the core C++ language. This sets you up well to continue your learning journey into other adjacent areas. So if there’s something you’re really interested in learning about, now’s a good time to see whether you have enough knowledge to jump into that.

However, for most users, I think there are a few natural next steps.

Data structures and algorithms

If you haven’t already learned about these, this is my strongest recommendation.

A data structure is a collection of data and a well defined set of methods to access or manipulate that data. The most common data structure used in programming is the array, which holds a number of elements of the same type in sequential memory. You can manipulate the data inside an array by using array indexing to directly access (or modify) the elements inside the array. In the lessons, we also covered the stack data structure, which provide push, pop, and top functions to access the data on the stack.

An algorithm is a self-contained set of operations that typically manipulate or calculate outputs from the data in a data structure. For example, when you look through an array to find the median value, you’re executing an algorithm. Binary search is an algorithm to determine if a given value exists in a sorted array. Sorting routines (such as selection sort and bubble sort) are algorithms that sort data sets.

Over the years, mathematicians and computer scientists have come up with a fairly standard set of reusable data structures and algorithms that are useful for constructing more complex programs. These all have various tradeoffs. For example, arrays are fast to access data and sort, but slow to add or remove elements. Linked lists, on the other hand, are slow to access data and sort, but very fast to add or remove elements (if you already know where those elements are).

Why does it matter? Let’s use an analogy. If you were going to build a house, you could build all of your tools from scratch if you wanted. But it would take a long time, and you’d probably mess quite a few things up and have to start over (ever created a hammer? Me neither). Also, if you use the wrong tool for the job, your quality would suffer (try nailing in nails with a wrench).

More likely, you’d go to the local hardware store and buy a few tools: a hammer, a level, a carpenter’s square, etc… and then read some internet tutorials on how to use them properly. These would vastly accelerate your house construction efforts.

Data structures and algorithms serve the same purpose in programming: they are tools that, if you know how to use them, can vastly accelerate how quickly you can get things done at quality.

The good news is that many of these data structures and algorithms have already been implemented in the standard library. You’ve already encountered some of these in the preceding tutorials: std::array, std::vector, std::stack, std::string, and std::sort, to name a few. Learning to use these effectively and appropriately is a great use of your time.

If you’re short on time (or patience), learning how to use the most common data structures and algorithms is the minimum you should do. But if you have the inclination, try recreating those data structures yourself, from scratch. It’s really good practice on writing reusable code, and will help you down the road when something you need isn’t in the standard library. But then throw them out, and use the ones in the standard library. :)

The C++ standard library

The bulk of the C++ standard library is data structures and algorithms. However, the standard library contains other things too, and another next step could be to explore those. Among other things, there are numerics (math) libraries, input/output routines, functions to handle localization and regionalization, regular expressions, threading, and file access. Every new release of C++ (which has been happening about every 3 years now) adds a batch of new functionality into the standard library. It isn’t critical that you know how everything in there works, but it’s worth at least being aware of what exists, so that if you happen upon the need for it, you can go learn more as needed. https://cppreference.com/w/cpp is my go-to reference for discovering what exists.

Graphical applications

In our tutorial series, we developed console applications, because they’re easy, cross-platform, and don’t require installing additional software. Unlike many modern programming languages, C++ does not come with functionality to create application windows, or to populate those windows with graphical elements or graphical user interface widgets (checkboxes, sliders, etc…). To do those things in C++, you’ll need to enlist the help of a 3rd party library.

Getting a graphical application up and running requires a few additional steps. First, you’ll need to actually install the 3rd party library and connect it to your IDE, so you can compile it into your program. Most graphical libraries should come with instructions on how to do this for the most popular IDEs. Next, you need to instantiate an OS window, which requires calling certain function from the toolkit. Most, if not all, of the libraries should have sample programs that you can compile and dissect if you’re not sure how to do something basic.

There are a lot of libraries out there, and which one you should use depends on your requirements (you’ll have to do your own research to determine which one is right for you). Popular choices include Qt, WxWidgets, SDL, and SFML. If you want to do 3d graphics, all of these frameworks support OpenGL, and there are great OpenGL tutorials on the internet.

Graphical applications typically run differently than console applications. With a console application, the program starts executing at the top of main() and then runs sequentially, usually stopping only for user input. Graphical applications also start executing at the top of main(), typically spawn a window, populate it with graphics or widgets, and then go into an infinite loop waiting for the user to interact with the window (via mouse click or keyboard). This infinite loop is called an event loop, and when a click or keypress happens, that event is routed to the function(s) that handle that type of event. This is called event handling. Once the event is handled, the event loop continues to run, waiting for the next bit of user input.

TCP/IP / Network programming (aka. the internets)

These days, it’s pretty rare to find programs that don’t connect to the internet, a back-end server/service, or leverage the cloud in some way. Any program that requires you to have an account and log in is connecting to a server and authenticating a user. Many programs connect to some service to check whether an update is available. Social applications maintain a persistent connection to a social infrastructure, to allow users to communicate with each other on demand. These are examples of networking.

Networking (broadly) is the concept of having your program connect to other programs, either on your machine, or on network-connected machines, to exchange information. Networking is a powerful tool -- in the past, if you wanted to change the behavior of your application, you had to release an application update. Now, with some good program design, you can simply update information on a server somewhere, and all instances of the program can leverage that change.

As with many things C++, there are libraries out there to help make your C++ programs network capable. The Asio C++ library is a commonly used one (there are two variants -- a standalone version, and a version that integrates with Boost, which is a library that provides a lot of different functions, much like the standard library).

Multithreading

All of the programs we’ve seen in this tutorial series run sequentially. One task is completed, then the next one starts. If a task gets stuck (e.g. you’re asking the user for input and they haven’t entered any yet), the whole program pauses. This is fine for simple academic programs, but not so great for actual applications. Imagine if your program couldn’t handle the user clicking on something because it was busy drawing something on the screen, or if the whole program paused/froze when a network call was happening. The program would feel unresponsive.

Fortunately, a method exists to allow programs to execute multiple tasks at the same time. This is called threading. Much like how (most of) you can walk and chew bubble gum at the same time, threading allows a program to “split” its attention and do multiple things in parallel.

For example, some graphical applications (such as web browsers) put the rendering (drawing graphics) portions of the applications on a separate thread, so that updating the screen doesn’t block other things (like accepting user input) while the drawing is happening. Network calls are often done on separate threads, so that if the network call takes a while to resolve, the application doesn’t grind to a halt while its waiting.

Threading is powerful, but it introduces additional complexity, and a lot of room for additional errors. Therefore, I wouldn’t recommend starting here -- but it is a good area to learn about eventually, especially if you want to do complex graphical applications or network programming.

Improve your fundamentals

Another option is to spend time improving your understanding of best practices. For this, I highly recommend having a read-through of the CPP Core Guidelines, with an optional delving into the GSL library.

A good bye!

At this point, I’d like to take a moment to thank you for stopping by and reading this tutorial series. I hope you enjoyed your time here and have found this site useful. Special thanks to those of you who have helped keep this website a free resource available to everyone by viewing ads that interest you. Please drop by again!

Good luck (and skill) in your future endeavors, and happy programming! And remember, old programmers never die -- they just go out of scope.

-Alex

PS: If you have any feedback or other suggestions for things to explore next, please mention them in the comment section below.


No next lesson
Index
B.3 -- Introduction to C++17

285 comments to C.1 — The end?

  • Jeremiah

    I started these tutorials much the same as many start their New Year's resolution -- not confident I'd stick with it. It took me a bit over a year to finish judging from my oldest comment I could find on the site (April 2017). I feel that may seem a bit slow but this was my first programming language. I think I struggled the most around chapters 6 and 7. It was well worth the challenge and now I feel like I've aquired a superpower. I still have much to learn and will continue to frequent the site to refresh my memory.

    Alex, my friend, thank you so much for sharing your expertise! I will recommend these tutorials every chance I get.

    • Alex

      You're welcome! Can you help me understand what parts of chapters 6 and 7 you struggled with most? That will help me determine where I need to provide more discussion and examples.

      • Jeremiah

        I don't have those chapters fresh in my mind but in the future when I reread these lessons I will share anything constructive in the comments.

  • Alex thanks this is the best c++ tutorial site can you recommend me to good graphics books or site.
    Your help will be much appreciated

  • Dan

    Hi Alex,

    I haven't finished the tutorials yet but I am enjoying making my way through them, firstly I'm just wondering if you wanted to get your C++ Associate or Professional qualification what level does the final tutorial leave you at? Does it just cover up to associate or would you need to understand other topics? Secondly just reading through there are suggestions for additional topics, I don't know if you cover it in the final chapters but C++ around engineering applications (control systems) or at least how to get into that side of things would be useful?

    Thanks

    • Alex

      I honestly couldn't say how prepared this would leave you for the qualifications, as I have no knowledge of what they test for.

      What do you mean by control systems in this context? Like writing code that runs on thermostats and the like?

      • Daniel

        I’m in aerospace engineering so it’s the electronic systems that control flight surfaces and real time applications using flight dynamics. At university we didn’t do a lot of electronics so it’s pushing my knowledge so feel free to correct me if I’m wrong

    • > how to get into that side of things
      Arduino and Raspberry Pi should get you started

      • Daniel

        Ok thanks guys for the help, I did just start looking at Arduino and labview as well so hopefully that will get me started. Thanks again for the tutorials they’ve been so good so far

  • Hao

    What can I say? Huge thanks!!!

  • Zablas

    Dude, huge thanks for this! Learned quite a lot. Recommended this site to all my friends who also want to learn programming in C++. A lot of my CLI projects wouldn't have been possible without these tutorials. Like this one for example: https://zablas.itch.io/ss-203x (should probably finish up that v1.2 that I started half a year ago...). Sadly I'll have to move on to C# as it is required for my university... But I'll definetly keep C++ as my primary language :D

  • zjh

    Thanks so much for this. This is the best tutorial on C++ that I've found.

    A section on makefiles would be greatly appreciated. I've found other resources online, but I really like your writing style and nothing I've read explains things particularly well.

  • Sabeel

    Just want to take a moment to thank you for this amazing resource. Coming from a Python/JS background This has been the most necessarily detailed and well explained introduction to the C++ language that I needed to get my feet wet into a language closer to the machine. And it has definitely enriched my knowledge and understanding of computers. Thank you very much for this amazing resource!

  • Xarxos

    Thank you so much for these tutorials! When I started using them I had zero prior experience with C++ and only very limited experience with programming in general (just a bit of Python), but I feel like these tutorials not only teach me all the things I can do with the language but WHEN to do certain things, when NOT to do certain things, and just good programming practices and conventions in general.

    When I was about halfway through the tutorials I tried writing a relatively complex program from scratch which I asked my brother, who has a master's degree in computer science, to review. He had some comments and concerns of course, but he said that overall the code looked well structured and intuitive, better than what some of his colleagues at his job produces, and I believe that the great care you've taken to teach proper coding conventions and making sure your students understand why these conventions are in place play a big part in why my code is relatively solid (for my level of experience, at least). So thank you for that, I'll be sure to recommend these tutorials to anyone else looking to learn C++!

    Finally, I'm just wondering if you have any concrete plans for what additions/changes to the tutorials you want to do next? I suppose I'll be checking back from time to time to see if there's anything new, so I'm just curious what I can expect in the near future if you have any idea about it right now?

    • Alex

      Thanks for sharing your story!

      I have lots of things on my to do list, but unfortunately very little time to actually implement many of those things. The things I'd like to get to most:
      * Stylistic updates and best practices compliance for chapters 16+
      * More tutorials around C++11/14/17 topics
      * More tutorials around the standard library, particularly containers
      * Some restructuring of existing tutorials to present things in a more intuitive order. Chapter 6 is particularly long.

      But realistically, I don't have much time at all these days, so I can't say any of it will happen soon.

  • Quoxa

    Yay,
    finally completed this tutorial. This is way overdue, but I did not want to clog up your inbox:

    Thanks for the awesome tutorial, Alex; for making it, keeping it updated and replying to comments.

    Also, thanks for answering questions in the comments section, nascardriver, even though you are not affliliated with LearnCpp.

    Lastly, thank you to the other readers as well, for posting comments which I learnt from.

    I really like the style of this tutorial, with step-by-step examples, and Alex's quips, jokes and references (in the conventional sense) within the chapters. On a side note, I think it would be better if every chapter has quiz questions at the end for the reader to review his/her knowledge, no matter how trivial they are.

    Once again, thanks for the tutorial for learning C++.

    • Alex

      Thanks for the feedback. The chapters beyond 15 still need a rewrite and update but I can't seem to find the time to actually do it. Someday!

  • Vissa

    Alex,
    there are no words to express how thankful I am for these tutorials. You have made everything very understandable, although covering some really hard topics, and you have achieved this in such an interesting way, that I (and I believe others, too) never quit learning from here, although frustration did exist at points where my coding didn’t go really well. I went from knowing nothing, to actually being confident programming in C++ in a few months.

    Having finished leaves me with bittersweet feelings. However, I want to continue learning. Therefore, let me ask whether you can give me reference to any book/website so as to:
    1. improve my problem-solving skills
    2. learn algorithms that are widely used
    3. learn multithreading

    Thanks a lot in advance!!

    Ps. Also grateful to nascardriver for the fact that he has always been there, answering any question from other users, which helped me learn faster and better, too.

    Thanks to both of you!!

    • Alex

      Unfortunately I don't have any good book recommendations for these areas. Best I can offer is to scour amazon and look for books aimed towards learning rather than being reference material. Sorry :(

      And yes, Nascardriver has been and is awesome.

  • Ritesh

    Hey Alex,
    Thank You so much for these amazing and comprehensible tutorials, you are an amazing teacher.
    Do you teach any other course ?
    I am willing to learn every part of c++ from network to graphical.

  • Levi

    phew that has been a long road started 26th of april and done 8th june. has been diffecult sometimes but awesome tutorials that helped me alot!

  • REQUEST

    I think comments should declare their type:
    – REQUEST for requesting new stuff, new features etc.
    – HELP for programming questions
    – FEEDBACK for correcting mistakes or improving clarity

    Or something like that. Maybe you can think of better ways to categorize user questions. This way you can focus on important stuff and leave the easy stuff to others.

    EDIT: I see some users have avatars. How do they do it? I just created a WordPress page and I have a Gravatar. I know this vain but I want to know.

    • Alex

      I've certainly thought about categorizing comments. But WordPress doesn't offer a plugin for this, so I'd have to code something myself. While that sounds fun, I haven't had the time.

      WordPress has a native gravatar integration. I see your cat gravatar.

      • PROBLEM SOLVED?

        Windows 7 Ultimate (64-bit)
        Firefox Quantum 60.0.1 (64-bit)

        I could only see 3 avatars on this page: yours, Ran's and Imre's. I disabled all my Firefox add-ons one by one, and refreshed the page every time, trying to find the problem. Nothing worked. I wrote a "bug report". I clicked "Post Comment" and my avatar miraculously appeared! I then deleted my comment – because it was describing a situation that no longer corresponded to reality – and proceeded to enable all my add-ons one by one. I can now see 4 avatars on this page, the 3 I mentioned before and mine.

        Are there more than 4 users with visible avatars on this page at this time?

  • Kiran

    Thanks Alex ,I am Thankful to You For lot of information .,And any Data Structures and Algorithms Like this

  • Ran

    Finally, I got this page! I am so happy!

    I've check my record on my GitHub. The first piece of code was committed
    on 21 Feb. That's 56 days( 1 month and 28 days). A total 110
    commits. All of them were written by myself.

    This is absolutely not the end. I plan to recap all the questions I
    put on your website (especially with nascardiver).

    Thank you nascardiver, you made my journey much easier and made me
    feel not alone.

    Thank you Alex. This amazing website gave me so much about c++
    programming.

    C++ will never out of scope!

    • nascardriver

      Hi Ran!

      Congratulations on making it to the end!
      I'm glad I could help you and hope you'll have a fun time developing your own programs.
      If there's anything more you need help with you're always welcome to leave a comment.

    • Ryan

      Hey can you share your github profile. I was curious to the type of projects you did along the way.

  • thanks alex, i hope all of your knowledge that you have shared. will be make you happy life and after life...,,, you're legend. arigatou gozaimasu. - the big new player that never give up -

  • Samira Ferdi

    Would you please teaching software development using C++?

    • Alex

      I cover various aspects of this throughout the existing tutorial, but in a scattered way (because the tutorial is focused on C++). Is there something specific you'd like to see more on?

      • Samira Ferdi

        I'd like to see you teach me how to make an application that I can install in my computer. And absolutely the GUI application too.

        • Alex

          > I'd like to see you teach me how to make an application that I can install in my computer.

          You mean like via an installer? Application installers generally require 3rd party software.

          GUI applications are a common request. I probably won't get to it any time soon, but it is on my list to cover at least at a high level.

  • SigmaCoder

    Hi Alex,

    I refer to this website a lot. I have found it very very useful. I'd say you could publish it as a book and it would be a great success. Thanks a lot for writing such a great series! Hope you find success in all your endeavors ahead!

  • Borja Rojo

    MFW

    Does this mean you won't be adding any more sections to these tutorials? These are really great, and I mean they are pretty much the best out there.

    In this goodbye, you seem to touch on a number of subjects that are not covered here. Please think about doing tutorials on these subjects! If you believe that they are advanced computer science topics and have no basis for being included in a C++ specific learning site, I understand, but I would love to have the chance to learn them from your writings in some way. Maybe make this a language section and expand to a 'topics of computer science' section, perhaps?

    You've done great work. I would hate to see it end. :(

    Of course, I highly appreciate what you've done so far! So thank you.

    • Alex

      I do intend to write more as time permits, but time has not been very permissive over the last few years. Most of the free time I do have goes to answering questions. Maybe I should do less of that and focus on new content?

      That said, as I add new things, they will likely be focused on core language mechanics (for a sneak peak, see the C++11 and C++14 appendices: the things that don't have tutorials yet), plus more about the standard library, which I brush on at multiple points but don't tackle in any substantive way.

      In any case, you're welcome. Feedback like this makes me want to keep writing. :)

  • Thank you again Alex for your amazing tutorials although I didn't finished to read yet, I would want you to advice me on computer organization and design or possibly architecture if it's really necessary for someone to write rapidly robust, fast and successful programs.

  • Asad Ullah

    • nascardriver

      Hi Asad!

      > would I be able to build graphical applications
      Graphical applications aren't covered on learncpp. However, if you want to write graphical applications all content on here is mandatory so it sure is a good start.

      > is their any certification for your program
      No

      • Asad

        I wanna ask you that what time it will take to become a graphics based application developer after going through your tutorials??

        • nascardriver

          This totally depends on how much time and effort you're willing to submit to learning. I'd say you could write decent graphical applications within a month if you tried hard. If you work/study/school/etc. I'd go for ~6 month.

          > your tutorials
          I'm not affiliated with learncpp, I just hang around here and answer questions

  • Omkar

    Hi Alex,

    First of all thanks so much for uploading such quality information on C++ that too free! Thanks to your tutorials, I have been able to get a pretty decent grasp of the basics of C++.

    I would like to move on to some advanced stuff like data structures and algorithms. It would be great if you could point out a good place to start learning these. (book/website). Thanks!

  • Imre

    Alex,
    I've finished the book for half a year now. I still come back for refreshing my knowledge, and just to snoop around stuff I've forgotten. I would like to thank you for this amazing tutorial series, plus the fact that you're making it free, its just amazing! Thank you!

  • Toribio

    I am barely 12 and already learned this language wow!!!!

  • Naga Pushkal

    Hi Alex.. Why don't you start your next tutorials on either Data structures or Algorithms or something else that you are interested? Because we don't want to miss you :)

  • Surya

    Thank you, Alex, For this amazing tutorial. I started my programming journey here a year ago and now I'm contributing to a machine learning library in C++ and it's all because of your beautiful tutorial that helped me gain a deeper knowledge of programming and OOP in general. IOU big time. Thank you

  • Gaetan

    Hi Alex,

    First of all, thank you for this unbelievable in-depth guide. I can't imagine how much time and effort you have put into this.

    I have stopped by here for several months now because I want to get into game development.

    I was wondering if learning about multi-threading was really essential to build graphical applications? Can't you let libraries like SFML handle that for you?

    Thank you!

    • nascardriver

      Hi Gaetan!

      > essential to build graphical applications?
      There were games before there was multi-threading, so no, it's no essential.
      Multi-threading is an important part of software development (Especially in gaming), you should not miss out on it.

      > Can’t you let libraries like SFML handle that for you?
      You can use libraries for everything, but that's not what you learned programming for.

  • abdurrahman

    Hi Alex , couple of typos (in the quotes)

    I think there "area" (are a) few natural next steps

    all of these "framework" (frameworks) support OpenGL

    and "the" when a click or keypress happens

    and Alex, do you think TCP/IP programming can be useful to learn? many employers list it as a must.

    I can safely say that this is the most well- explained tutorial for C++, and I can never thank you enough for making this.

    • nascardriver

      Hi abdurrahman!

      > do you think TCP/IP programming can be useful to learn?
      Useful? Definitely. Must? No, there are enough libraries to handle networking for you.

    • Alex

      Thanks for pointing out all the typos. Fixed!

      TCP/IP programming could definitely be useful depending on the context of what you're doing. I've updated the suggestions to include both that and multithreading. I appreciate the suggestions.

  • Lazar

    Hey Alex,
    Thanks for this incredible tutorial, probably the most detailed and the best one on programming, especially c++, but i wanted to ask, do you have experience in graphical applications and can you show some of them to us or do you think that isn't neccesary?
    Again, thank you for the hard work you put in.

    • nascardriver

      Hi Lazar!

      I'm not Alex but I have worked with graphical applications. Native windows on Windows and Linux (X11), DirectX and OpenGL.
      My opinion is that native windows shouldn't be here, because they are OS-specific and mostly written in C which makes them a pain to work with.
      DirectX and OpenGL /could/ be here but it'd double the size of the tutorials, because there's so much that can be done and writing all those tutorials just isn't worth it. If you're confident with C++ you should be able to learn DirectX and OpenGL from other sources. I'm not affiliated with learncpp, deciding on new lessons is up to Alex.

    • Alex

      I do have experience with graphical applications. I always think showing is better than telling, but I don't have time to put this together and explain it in detail right now. :(

      That said, SFML has a simple example app here. If you're not aware, a sprite is just an image. This example shows instantiating a graphical window, displaying an image, drawing some text in a particular font, playing some music, and then waiting for the user to close the window.

      This is an example of using SDL to create a 3d graphical window and filling it with random colors.

      You won't be able to compile either of these without installing the respective libraries, but it should at least give you some indication of what these programs tend to look like. If these look complicated, they aren't really. If you've gone through these tutorials, you should understand all of the syntax. What you're missing is what the specific library function calls do, and maybe some of the specific vocabulary/nomenclature around dealing with graphics, sounds, and event management.

  • Mahmud

    Alex,

    While I am still in the beginning of your tutorial series (in Chapter 6 to be precise), I would like to stop short for a while and take the moment to thank you for all your efforts. This has been by far the best and most accessible C++ resource I have found ( despite the numerous books that I have gone through in the past). Thank you for presenting the material in a palatable form and thank you for covering so many things.

    All the best and God Bless

Leave a Comment

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