Skip to playerSkip to main content
#programming #coding #cplusplus
Transcript
00:00right on this video we will learn some c++ basic here so when you gotta do printing a string
00:10to a console you can do it like this this is the main example from its default from the
00:18visual studio default you can do let's do it from the beginning std
00:30code and hello work hello world world and you can strike it like this and then you start to play
00:45play store the application and as you can see wait a minute it doesn't record the
00:52shit the console here hold up i got the debug
01:03okay the debug itself doesn't show its output so we gotta do move by recording the whole screen
01:18screen capture display capture all right okay this is our main display so we can see here
01:28when we start the programming just uh it immediately says the what we says here
01:35now how do we do some some math like one plus one like that but we will need to
01:48define a variable for instance this is an automatic variable so you can just create auto sum
01:57and the value of sum is one plus one so you gotta print it like this std out
02:11and some
02:15but here it should be integer i don't know if it's directly uh passing this sum value into variable
02:25into a string let's just see okay okay it immediately
02:32convert it to string so we can see here is two what if we gotta do one divide by one
02:42we can just write it like that okay now it says one what if one multiple by
02:52six to seven the result should be six to seven right so as we can see is
02:58coming up as 67 okay let's try to do a manual way if this is a float
03:10load so it's 6.7 load and let's just try to write two and sum okay what is the value
03:21of the result okay it's 13.4
03:24let's discuss this that is a simple mathematics in c++ and now what you gotta do is
03:33uh learn how to create a function uh learn how to create a function this is the main
03:39entry point this is the entry point
03:45entry point point entry point is where all the shit is being executed
03:51so you gotta write a new function to make it better like to create a new function
03:57you can use keyword void we'll probably void call you play
04:06all right so we can do it like this load
04:14ah a and load b and inside the block inside the function we can do like a multiple
04:25multiple where is multiple is a multiple b and then we can just do the count here std
04:41count
04:48okay okay okay as you can see here it is okay the identifier is wrong
05:03yeah you know why why is it wrong the identifier here so we gotta convert the
05:11value of value of wall into a string
05:20but but you gotta include
05:27include the string
05:32here so you can use the std to
05:41string
05:45okay okay okay okay for the identifier
05:50cd code the problem here okay so i was assuming the wrong thing
05:57uh what if we doesn't refer it okay it's probably fine if we doesn't refer the value
06:03okay okay as we can see there is nothing because it doesn't being called in the entry point so in
06:10the
06:10entry point we should call the calculate but we need to assign the value so auto
06:19uh num num num and the number is from user input for any for an example you can do
06:31uh something like this yeah let's just assign the value zero to it and std
06:46okay
06:48okay and we can copy this to num1 and num1 so num num1
07:00okay just like that and we can try running the program again and now it is asking for what we
07:09don't didn't print anything uh for the asking question uh for instance we can do 10 multiple by
07:17five so it should say 50 all right it says 50 here but there is nothing it says to input
07:24the value
07:25so we can do it like this std code
07:32okay we can say just say verse value and we gotta do an end line by giving it std end
07:44line
07:46handle okay like that so the second one we gotta edit here second value
08:02okay okay if we run it again it will now as the first value 10 multiple by 6 this is
08:1260 all right
08:13this is a simple mathematics in simple physics
08:18now what if we will do something better like doing some pointer sheet
08:29maybe you you have a variable of integer and the name of the variable is num and the value of
08:38num is 35
08:41right so the num values 35 and what is address of that num we can do it like this and
08:50num all right
08:52not to pull out while num and num like that so this auto we will see okay it give it
09:06a variable
09:07well so we can do maybe int ptr
09:15intptr right
09:16and now num just
09:20test it to intptr
09:23nope
09:27wait
09:33int intptr
09:36nope
09:36hold up i forgot what is the
09:39or maybe it's just just give it auto
09:44right and now let's try to print it
09:48into the console
09:55and while
09:57okay let's see what's the value it gave
10:01okay now it giving us the address of this
10:07variable
10:08four zeros
10:10okay so how do we read this value it's not like
10:15like that we can do it like
10:17let's open notepad
10:19so let's try to copy it here
10:25okay so this is the address right
10:27this is the address
10:29so you got to read it like this
10:31you can't skip those four zero value and turn it like
10:36become like this
10:37so the address is this
10:39the
10:41the hex address if i'm not mistaken
10:43but if i'm mistaken you can correct in the comment below
10:56right so this is the address of this
10:59num variable
11:00it's the pointer
11:02okay
11:03what if we do it like this
11:06so we got the num
11:09the val
11:10it is the pointer of num
11:14okay so we do in num one
11:19and give it a value of val
11:22but here
11:28we do it like this
11:33no no no
11:35wait a minute i forgot
11:37it's the pointer of num
11:38it's the pointer of num
11:41it's the pointer of num
11:43it's the pointer of num
11:47it's the pointer of num
11:48it's the pointer of num
11:49it's the pointer of num
11:50it's the pointer of num
11:50it's the pointer of num
11:50it's the pointer of num
Comments

Recommended