C++ has a reputation for being a very difficult language to learn, and to use well. Changes to the language and the library that accompanies it have changed that. Beginners can now learn C++ and write real applications. In this course you'll learn the important parts of C++ 11 syntax, get an introduction to the most useful parts of the Standard Library, and be challenged to write applications yourself in addition to watching someone else write and explain code.
Kate Gregory is in her fourth decade of being paid to program. Her firm, Gregory Consulting Limited, is based in rural Ontario and helps clients adopt new technologies and adjust to the changing business environment. Current work makes heavy use of .NET and Visual C++ for both web and client development, especially for Windows 7 and 8. Managing, mentoring, technical writing, and technical speaking occupy much of her time, but she still writes code every week.
Getting Started Hi, welcome to Learn How to Program with C++. My name is Kate Gregory, and I've been using C++ for over 20 years. When I started, Microsoft didn't even have a C++ compiler. It wasn't the first language I learned. That was Fortran, but it can be the first language that you learn. This course is for you if you want to be a software developer. And you're willing to learn C++, as your first language. Perhaps you want to write games, or mobile applications, or cross platform applications. It doesn't matter what hardware and libraries you're planning to work with. This course will teach you the syntax and the idioms of the language, and the good news is that the C++ of today is actually simpler than the C++ I learned over 20 years ago, simple enough that you really can use it as the language you learn while you're learning to program.
Streams, Locals, and Flow of Control Hi, welcome back to learn how to program with C++. My name is Kate Gregory and I'm introducing you to programming using C++. In this module, I want to take your ability to put code in a file and compile it and then run that. And move on to writing applications that actually do something. The very first something I'd like an application to do is to put something on the screen to show that it actually ran and it really was there. In order to do that, I need talk to about libraries, and then stream IL. Once you've done that, and you get that. Then you can move into the sort of meat and potatoes of every application you ever wrote. Local variables, and controlling the flow of your application, making decisions in code. Repeating yourself if necessary in code. Those fundamental building blocks, the idea of local variables, and working with them and making decisions or taking action based on them, is what all applications are built out of. The ones you'll write in this module will be very simple, but they are the building blocks for the more complicated things that you can build later.
Functions and Headers Hi. Welcome back to learn how to program with C++. My name is Kate Gregory and I'm introducing you to programming using C++. Earlier, you saw how to send information to the screen using Stream Aisle. And you were using functionality from a library. Some of that capability is provided as functions. And in this module, you'll see how to write your own functions and to call them. You'll also see how to make sure the compiler and the linker pull everything together properly. As part of that, I'll introduce you to a very popular convention in C++. The language doesn't demand it, but we all tend to use it, known as header files, and including header file. By the time you finish this module, you will understand some of the things that you saw in previous modules with this little starter, do nothing application and with some of the changes that we've made to that application since but I didn't fully explain.
Strings and Collections Hi, welcome back to learn how to program with C++. My name is Kate Gregory, and I'm introducing you to programming using C++. This module is where you start to understand classes. You know an early name for C++ was C with classes. In many ways, C++ built on that heritage of C, but added this incredibly powerful concept of classes. And a class is a type like int or double that's defined by a programmer rather than the language committee. Someone else decides what int does, but you decide what employee does or bank account. And, as I've mentioned before, sometimes the programmer's, the library writer. You use most libraries by using classes from them and you will write your own classes, too. Two incredibly useful classes in the standard library are string and vector, which I'll show you in this module.
Writing Classes Hi. Welcome back to Learn How to Program with C++. My name is Kate Gregory, and I am introducing you to programing using C++. Throughout this course I have shown you how to use something before showing you how to create it yourself. Here is how to use code someone else wrote. By using something from our library say, to put some characters on the screen, now here is how to write a function. See how that's the same. You've also now seen how to use classes. String is a class and you make instances of it. Strings with individual names like name and greeting. And iStream is a class. And there's an object that's an instance of it called See In that you use to get characters someone typed on the screen. oStream's a class, and there's an object that you can use that's an instance of that class See Out, that you can use to put characters onto the screen. So in this module, you'll see how to design a class. How to write a class, and then how to create and use instances of the class, which are also called objects, to actually have your application do something.
Compiler Specific Topics Hi, welcome back to learn how to program with C++. My name is Kate Gregory and I'm introducing you to programming using C++. C++ is a complicated language. And we started with the simple parts and worked our way forward, and we haven't covered all of it by any means. But you can write programs that really do things. But it also has some fairly complicated tools, and I've been glossing over some of the complications in the tools. So, in this module, I'd like to spend a little time talking about the tools. Visual studio, for example, will make projects for you, but they won't look like the projects I've been showing you. So, I want to explain that a little bit further. And, I want to show you a little bit about how to be more efficient if you're using a command line compiler, like the GCC compiler that we've been using as an alternative to Visual Studio throughout this course. Or anything other compiler, like Clang on the Linux distribution of your choice, for example. Just so that, kind of, nothing up my sleeve when it comes to the tools you'll be using.
Topics to Learn Later Hi, welcome back to Learn How to Program with C++. My name is Kate Gregory and I'm introducing you to programming using C++. And that's an important distinction. I'm not trying to teach you all of C++. I want you to be able to write a program, to be able to think of a problem. Figure out a way you might solve it, or you might represent the information you want to work with and be able to write enough C++ to implement that program. Enough that you can see something starting to happen, whatever it is that you wanted your program to do. Because that's my philosophy I haven't taught you all of C++, and I'm not going to, at least not in this course. I do want you to know how much more there is. It's fine because you now know enough to learn the rest of C++ when you need it from an ordinary course aimed at programmers. This module is just to make sure you know that the remaining topics exist to tell you about the parts I haven't touched on so you know what else is out there for you.
Legacy Constructs Hi welcome back to learn how to program with C++. My name it Kate Gregory and I'm introducing you to programing using C++. Most of the time developers write code, but especially when you're new to it you may not realize how often developers read code. You might do it to understand how to use a particular framework, or library, or little piece of one. How do I make this thing here resize automatically, you ask, and you go out on the internet, and you do some searches, and you find a piece of code, and you read it over and you say, oh I get it. I know how to do it now, fantastic, and then, you don't necessarily copy and paste that into your application, but you certainly take what you've learned from reading that code and put it into your application. And for C++ developers, one of the problems that can happen when you do that is you run into really old code, and C++ has changed as a language over the decades. So there are things you're going to bump into in old code that you would not ever use yourself. Rewriting that old code into shiny new modern code that's, that's safe and readable and much like the code I've been showing you elsewhere in this course. That's way out of scope for a beginner, but I need to show you those kind of old school constructs, those ways we used to do it, literally 20 and more years ago, so that you can read them and understand them if you come across them.