Search

Appendix C — 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. http://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.

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

41 comments to Appendix C — The end?

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

  • 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]