learn everything you need to know about C++ from the basics to more advanced
concepts so by the end of this course you'll be able to write C++ code with
confidence if you're looking for a comprehensive easy to follow well organized
and practical course that takes you from Zero to Hero this is the right C++
course for you you don't need any prior knowledge of C++ or programming in
general everything you need to know about C++ is in one place
00:00:32 so you don't need to jump back and forth between random tutorials
my name is msh hamadani I'm a software engineer with over 20 years of
experience and I've taught millions of people how to code through this Channel
and my online school code with.com if you're new here be sure to subscribe as I
upload new videos all the time now let's jump in and get [Music] started before
we start coding let's spend a couple of minutes and talk about C++ what you
can do with it and how to master it C++ is one of the most popular
00:01:09 programming languages in the world and is the language of choice
for building performance critical applications video games device drivers web
browsers servers operating systems and so on that's why it's used by large
companies like Adobe Google Microsoft Netflix and even government agencies
like NASA just to name a few every 3 years we get a new version of C++ and the
latest version at this time is version 20 the next version is coming out next year
now there are people like our famous superstar
00:01:41 developer John Smith who think that C++ is no longer relevant
because of the newer languages like Java or C that is not true C++ is still one of
the fastest and most efficient languages available so if you want to build an
application that needs to be fast and use memory efficiently C ++ is a great
choice this is an advantage that it has over languages like C and Java C++ is also
one of the first languages often taught to computer science or software
engineering students because it has influenced many programming languages
00:02:16 like C Java JavaScript typescript Dart and so on so if you're looking
for a job as a software engineer learning s++ is a great investment and opens a
lot of doors for you according to indeed.com the average salary of a C++
programmer in the US is just over $170,000 a year now to master C++ there are
two things you need to learn one is the C++ language itself meaning the syntax
or the grammar of this language the second thing you need to learn is the C++
standard library or STL which is a collection of pre-written C++ code
00:02:53 that provides functionality that is required by many applications
examples are data structures like list lists and maps and algorithms for searching
and sorting data these functions are required in almost every application so
instead of us creating all this functionality from scratch every single time we can
,reuse some of the C++ code in this library to quickly build applications in this
course we'll explore major functionalities in the standard library but the standard
library is huge so we'll only scratch a
00:03:25 surface if you want to learn more there are books specifically
written on this topic now a lot of people find C++ a bit extensive and
intimidating but in reality you don't need to learn all of C++ to be able to write
substantial programs for the same reason you don't need to learn every feature
your TV provides just to use and enjoy it so in this course we're going to explore
C++ step by step and as we go I'm going to show you how you can write some
really cool programs as you're learning C++ plus I'm going to give you plenty of
00:03:56 exercises to help you better understand and remember the concept
STS then you will see that C++ is not really that difficult so if you follow along by
the end of this course you'll be able to write C++ code with confidence all right
next we're going to talk about the tools you need to write C++ [Music] programs
to create C++ programs we use an integrated development environment or IDE
which is basically an application that contains an editor for writing code as well
as build and debugging tools now
00:04:33 there are so many different ideas out there some of them are free
the others are commercial but the top three ones are Microsoft Visual Studio for
Windows the Community Edition is free you can get it from the link on the screen
there is also a Mac version but the one on the Mac is not really that great for Mac
you can use xcode which you can get from the App Store we also have cion
which is crossplatform so it runs on Windows Mac and Linux you can trade for
free for 30 days but then it requires a license if
00:05:03 you don't want to pay for a license you can use one of the free
Alternatives again there's so many different ideas available for creating C++
programs in this course I'm going to use C lion but you don't have to use it to
follow along you can use any tool you prefer because our Focus here is not on
tooling it's on the C++ language itself now if you're an absolute beginner and
you have never coded before I recommend you to download the free version of
celan so you can easily follow along and then later you
00:05:32 can either get a license or use one of the free Alternatives so head
over to Jet brains.com celion download again you can see we have versions for
Windows Mac OS and Linux just note that if you're on Mac make sure to
download The Right DMG because here we have two different builds one is for
Intel the other is for apple silicon so depending on the type of processor that
your Mac uses make sure to download The Right DMG because the difference in
performance is significant all right so go ahead and
, 00:06:04 install this in the next lesson we're going to create our first C++
program [Music] together so the first time you open C lion you're going to see
this popup box for activating your license for now just select start trial now you
need to log into your jet Brands account so over here you can either sign in or
create a new account it's really simple it's only going to take a minute or two so
I'm going to sign in with my account good now back to cion we can start our trial
now on this page we're going to
00:06:47 click on new project now on the top we can specify the location of
this project so on my Mac it's going to be on users SL my name/ celan project I'm
going to call this project hello world all in one word without any spaces okay now
over here we can specify the C++ language standard so by default version 14 is
selected but we can change that to a higher version like 20 or 23 now because
23 is not official yet I would suggest you to go with 20 good now let's create this
project all right here's our first C++
00:07:27 program written in a file called main.cpp if you accidentally close it
you can easily find it in the project window so expand this folder and here is
main.cpp now we have another file in this project called cmakelists.txt we don't
need that so let's close it from here now we have the same concept in other IDs
like Visual Studio or xcode so we have a project and that project contains a file
that is the main file of our program now let's close this window I'm going to
delete all this code because we're going to write it
00:08:03 from scratch so you understand how everything works all right let's
start with a metaphor think of your TV your TV has several functions it has
functions for changing the channel controlling the volume and so on by the same
token a C++ program consists of tens or hundreds or thousands of functions
each serving a purpose now we have a special function here called main which is
the entry point to our program this this is like the power button of a TV okay now
note that C++ is a case sensitive language so
00:08:35 it's sensitive to lowercase and uppercase letters so make sure to
type this exactly as I show you so if you type a capital M here this is going to
have a different meaning okay so we're defining a function now before the
function name we should specify the type of value it's going to return this main
function should return a value of type int which is short for integer and that
represents a whole number like 1 2 3 4 and so on so when we run our program
the operating system like Windows or Mac OS
00:09:07 is going to execute this function and the value that this function
returns tells the operating system if our program terminated successfully or not
okay so here we have int followed by whitespace and then the name of the
function now whites spaces in C++ are often ignored so whether we have one or