90 Video Views·Apr 21, 2025
C++ (C plus plus) is often considered one of the most challenging programming languages due to unique syntax and challenging program structure. However, it is extremely versatile, and considered one of the best languages for speed and efficiency, and is used as the language of choice for the Unreal Game Engine!
Starting with this video, I will attempt to make learning C++ approachable and fun in small and easy to understand tutorials on the channel! If you have any questions, or thoughts on what you'd like to see next, just let me know about it in the comments! This video shows how to create your first program in C++ using Microsoft visual studio including defining a namespace, creating your first function and using some basic variables while printing information out to the console window!!
Don't forget to leave a like on the video and subscribe to the channel to help me out with the YouTube algorithm!!
If you like the content coming out of the channel and want to become a super supporter of LeMaster Tech, feel free to check out my Patreon at the link below!!
Good luck with your code and thanks for watching!
hello welcome back to the master tech
and today's video is going to be episode
one in getting started with c plus
programming
[Music]
so for our introduction series to c plus
plus we are going to use the microsoft
visual studio ide um it's really
powerful it's really easy to use and
it's totally free to download for
personal use so the steps for installing
it are actually going to be the exact
same as the steps were for installing it
for c-sharp which i already made a video
on where i went into more detail about
where to get it so i'll leave a card to
that video somewhere in the top of your
screen right now if you need help
installing visual studio but i'm going
to assume you've got through the visual
studio install and so we can go ahead
and get started with actually
programming so when you boot up visual
studio you get this splash screen and
what you'll want to do to start is just
create a new project hopefully it looks
like this and it'll right away it'll
give you the languages it has that you
can program in
and so obviously we want to do c plus
since we're doing a c plus plus now you
could do a console app um this is okay
to start with i'm gonna start with empty
project just so that i can make it uh
kind of clear um you know
where everything comes from so for this
one we'll just call
this project c plus plus um
getting started
like that
and hit create and it's going to do some
um
logic behind the magic behind the scenes
to basically set up the framework of a
project for you that's why i like visual
studio
i know a really simple one if you don't
have the computer space for visual
studio a lot of people
have luck with code blocks that's a
really simple ide for c plus plus and i
think it works for c sharp as well
you can check that one out if visual
studio is too big too much of a headache
but anyways once you have uh loaded in a
new project and you get to kind of this
window where obviously there's nothing
going on you come over to your that um
like tree your project explorer
right click the name of the project you
just made and go down to the option for
add
add new item
and then it's gonna by default it's
probably gonna go to this visual c plus
plus
and you want this c plus file which is a
dot cpp if you're using a different ide
a different programming um format just
figure out where c plus plus file is
stored it's going to be a file that
gives you a dot cpp
file extension and then uh name it
something uh typically like main for
your first one is a good idea to name it
but you can call it whatever you want
and then just hit add and you'll see
down here in the
project
tree you'll you'll get main.cpp pops in
and
let's go ahead and create just a hello
world program real quick to get like the
console the terminal window to pop up
and display
hello world because that's really a very
simple way to start programming so first
thing you want to do is this pound
signed include and then in
like arrows pointing out greater than
less than signs
do i o stream and this is just what you
need to be able to uh this is what you
need to be able to do like console in
console out commands
and then the first thing you want to do
is just define a namespace and so this
is um this is going to be something
pretty standard that i'll get into more
as we get into more advanced concepts
but for now just understand like this is
creating a little development world for
you to put functions and program uh
programming inside in uh future programs
so uh we're gonna do using namespace std
for standard not like us you know std
you weirdos anyways um and then we're
gonna do this int which is basically
like initialize and then um we're going
to create a first function that we're
just going to call main and so that's
going to look like this um int main
and actually sorry it's it's not
initialized it's integer but um so then
this main and then parentheses is uh
creating a function and then inside your
function you need these curly brackets
so this if you've programmed in c sharp
this probably looks pretty familiar
because um this is fairly similar and
actually i'll say that right now like a
lot of what you're gonna see in c sharp
should
kind of be familiar um to what you're
gonna see in c plus plus so if you're
trying or even if you know c
they're all based on c languages so
you're going to notice similarities but
there's a lot of syntax differences as
well c plus is generally considered one
of the hardest programming languages to
write in and honestly even like
you know developers like myself who
really only work on personal projects i
kind of steer away from c plus i prefer
c sharp but um i think this tutorial
series could be really helpful and i
think it could help me grow as a
programmer as well so if you have any
questions or comments about anything you
see or even corrections uh constructive
feedback let me know in the comments
below and we'll make this thing as good
as we can together so
inside these curly brackets is where
we're actually defining the code that's
going to run in our main function
and so to get something printed onto the
console window that's pretty easy you
just do this c out
which means console out and then two
less than signs and these less than
signs are kind of like um separators i
don't know the official term for the the
key but it's like it can kind of act as
an append function so like when you have
a string and you want multiple things to
be like on there you separate them all
by these less than signs
and then use quotations and hello world
like this hello world and then two more
less than signs and you have to use this
when you're printing you need end l
which is end line
and this is going to give you one row of
text on a console application when we
pop it up but very important if you
don't want the
code to just close as soon as it opens
you need to include this return zero at
the very bottom
and so what you're looking at right now
is really the most basic uh function
that i can you know show you guys to get
started with c plus plus um
and you depending on the ide this might
say like uh build and run or compile and
run um on visual studio it says local
windows debugger
but basically when you run this it's
going to take all of the code you just
wrote
and convert it into a language your
machine understands and then um
hopefully i think i can make this a
little bigger so you'll see there hello
world and it's just giving us this
default code exited with code zero and
then press any key to close this window
so you can just press a key and close
the window but
basically this is going to be like the
default where you want to start from in
the future so
this kind of program is just a nice
framework you can put all your basic
code inside of this main routine
and this syntax is kind of what you want
to follow a quick note you don't
technically have to do the tabs for
spacing i find it's a little easier to
organize your code if you do it this way
but actually that's uh that's an
optional step um it's not like python
where the number of tabs in ur actually
determines how the code runs as long as
it's in these curly brackets
okay so that's a hello world program
let's go ahead and talk quickly about
how
it processes multiple lines of text so
your program and this should be very
familiar to anyone who's programmed in
any languages before but if you're an
absolute beginner don't worry we'll talk
about it real quick
so
it's it is going to execute top to
bottom so in general if uh if it's if
you're coming down trying to debug and
see what's happening unless a function
or a class is called meaning like
something that was written on line two
gets called on line 12 and then it jumps
back to that point it's going to execute
from top to bottom so as we enter this
main function it wants to run hello
world and then it's going to run this is
line two so let me go ahead and do this
is
line one and then this is line two and
if i run this now
okay you'll see we get this is line one
and then this is line two so hopefully
that's explaining like the order in
which this thing is executing
um and so that's just a little piece you
want to understand like if you try to
say like um you want to use math but
you're using a variable that you define
later so if up here i was like a plus b
and this isn't proper format i'm just
trying to explain this but down here you
said like a is three b is five well this
is going to give you an error because
and you also need semicolons at the end
of every line but like i said this isn't
a actual thing
this would always throw an error not
just because it's bad syntax but because
you're trying to use variables that
haven't been defined yet so it's not
like oh well i defined the variables
somewhere in the pro project
it's no you have to define all of your
variables before you use them at all so
that's just why i want to show this kind
of two lines of text to sort of explain
the order in which your code is going to
execute
and i think this is just an easy way to
illustrate it you saw line one prints
out before line two
and i think one last thing i'd like to
do in this very introductory video is
just quickly talk about
introducing variables so if we wanted to
print out a line of code that was my
name is pete and then i am
i am 25 like that
we could do this this is a valid program
it's going to execute so my name is pete
i am 25. okay it looks fine it did what
we wanted to do but let's say we want
this same code to be able to run and we
want to be able to quickly and easily
change name and change the
age
we can introduce what is called
variables and these are pretty universal
across all programming languages but
the format is maybe not what you're used
to seeing before so to introduce a
variable
you start by
instantiating it calling it defining it
initializing it whatever you want to
call this the first time you introduce a
variable
you say the variable type so like a
person's name is going to be a string so
string my name and then you can leave it
at that or on this same line you can do
equals and then give it an initial value
so for me i'm going to say string my
name equals peter and i'll show you what
i mean on this next line i'll say we
also want an integer for age and i'll
just say
integer
my age like that and i'm going to leave
it there and now what i'm going to say
on the next line is my age equals 25
okay so this is also a valid way of
doing it most of the time if you have a
simple variable that you're initializing
you're going to put it all in one rung
just like this
but you could do it this way that's fine
and now to actually use these in our
strings
let's take a look at how we do that so
here's where using those less than signs
to concatenate or add multiple things
together
comes in handy so instead of my name is
and then peter we're going to say my
name is and then less than less than
sign and then the variable my name
and then end the line and it's the same
thing uh for
the
uh age but what's kind of nice is you
don't have to convert
my age to a string it knows that this is
just displaying text and so if you have
an issue where like in python this would
throw an error because you're trying to
concatenate an integer with a string and
those two different types of data can't
just be combined without converting your
integer to a string
in c plus plus it can just use these
less than less than signs to display i
am and then 25 and then still have the
end line so this should work as long as
i didn't put any errors or anything
stupid in here so let's go ahead and
take a look
okay and we get my name is peter and i
am 25 and that's pretty useful um
but you may be saying well we only use
it in one place so what's really the
value in that well let's say uh
i
like the name
my name and then
next year
i will be
and
we'll say
you know in this break we're going to
redefine my age so we'll say my age
equals my age plus one
okay we've used this same variable and
we've just added one to it but now
we are
going to use that variable again so now
let me get rid of
d
so now if i run this you are going to
see it's a little story about peter
being named peter and
i like uh being you know i like being
named peter but next year i'll be 26 so
basically we've used that variable twice
now
well let's change this to uh
jack and 28 okay so let's do it this way
just by changing the initial values of
this variable i've changed the entire
program so now it's going to say my name
is jack
i am 28 years old 28 i like the name
jack next year i'll be 29. so our whole
function is still valid just by changing
a few variables
instead of having to come in and change
text in four different lines of output
so this is a super super preliminary
introduction to c plus plus getting
started using the visual studio ide
creating a project displaying uh inputs
or displaying outputs onto the console
window as well as a few ways to use
variables
i believe what i'm going to do on the
channel in terms of format is i will
probably make tuesdays a non-python day
so c plus plus maybe some c sharp we
might eventually get into like uh unity
and possibly some game engine
type stuff
i want to use tuesdays for non-python
content because i obviously do a lot of
python content and would like to
continue um so i will probably keep that
on fridays if you have any thoughts on
the format on what you'd like to see on
the channel or how i could make it
better please leave me a comment i love
seeing constructive feedback and i want
to know what i can do to make uh the
tutorials and the experience better for
you guys so thank you very much for
watching the channel
don't forget to leave a like on any
video you found useful subscribe to the
channel it helps me out a lot i'm trying
to get the channel started here and if
you want to be a super supporter i will
leave a patreon link in the description
below any
tier of support is really really
appreciated but absolutely no pressure i
want to keep bringing these tutorials to
you guys no matter what so thank you
very much and until next time good luck
with your code and thanks for watching
thanks bye