background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Изучение C++ в одном видео уроке за час!"

input logo icon
Video tags
|

Video tags

c++
c++ за час
c++ для начинающих
c++ уроки
c++ программирование
в одном видео
C++ с нуля
основы c++
программирование
уроки
изучение c++
ооп c++
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:01
learn C plus plus with you for everything
00:00:03
just one video, that is, we will be with you
00:00:05
parse variable conditional operations
00:00:07
cycles and many other things that
00:00:09
present in C plus plus language
00:00:10
so that after this you can say that
00:00:12
you are a plus plus developer
00:00:14
in this video tutorial I will work on
00:00:16
Mac if you work on Windows then this
00:00:18
does not pose any problem, that is,
00:00:20
the code will be exactly the same here and there
00:00:22
it will also be executed in the same way
00:00:24
Accordingly, you can work on Windows and
00:00:25
repeat after me I will work in
00:00:28
such a program as xcode it
00:00:29
specially designed for poppy if
00:00:31
you are on Makita pension midges download and
00:00:33
work not here there is a development environment
00:00:34
from si plus plus if you are on
00:00:36
windows then it will be wonderful for you
00:00:38
the program is visual studio
00:00:40
Accordingly, I will leave a link to
00:00:41
download this program in the description
00:00:43
video you can basically just
00:00:45
download this program but if you
00:00:47
don't want to bother at all
00:00:49
about various programs then I will leave
00:00:51
another link in the video description
00:00:53
this is an online compiler in which you
00:00:55
you can enter your C plus plus code and
00:00:57
accordingly it will be here
00:00:58
process the question click later
00:01:00
button wounds and this is also the same
00:01:02
will be for you and what is a text editor
00:01:04
visual studio or for example xcode for
00:01:06
me also visit the site and Cyprus
00:01:08
gear dot com link to this lesson at
00:01:10
the site will be in the description of the video here you
00:01:12
you can find many homework assignments
00:01:14
other useful things for this video
00:01:16
roba so you will like the link here
00:01:17
in the description now I will create a new project
00:01:19
you can make the cake for example
00:01:21
visual studio or their fx hadise wanna
00:01:23
make that is, crits
00:01:24
xp xcode project then we select come
00:01:27
on line tool that is, the pants themselves
00:01:29
everyone calls a simple tutorial app
00:01:31
this project will be called our tutorials
00:01:34
they'll call it a sandwich, I choose it as C Plus
00:01:36
plus we, accordingly, there’s nothing more here
00:01:38
no need to do location download
00:01:40
it suits me and now we have a project
00:01:42
I'm already completely ready, an error has popped up
00:01:44
but it doesn't matter at all that she is now
00:01:46
it's highlighted here, let's go to our
00:01:48
main file this n.
00:01:50
and these pipettes are just extensions
00:01:53
plus plus respectively to any file that is in
00:01:56
which has cat si plus plus we must
00:01:59
add extension . si pi pi
00:02:01
what's going on here first of all iodine
00:02:04
some comments that we absolutely
00:02:06
unnecessary and we can just delete
00:02:08
Next comes connecting the library:
00:02:10
one of the main libraries
00:02:12
which allows us to perform enormous
00:02:13
number of different operations in our
00:02:15
let's all write clean code
00:02:18
sheet so I'll delete everything and start again
00:02:20
I'll connect a library for example
00:02:22
airstream library and streams on
00:02:24
mobile helps us display for example
00:02:26
some information you console either
00:02:28
read this information accordingly
00:02:30
this is one of the key such libraries
00:02:32
then let's connect some more
00:02:33
several libraries just so we have
00:02:35
somehow it was not let there be a library
00:02:37
steering will allow us to work with
00:02:38
strings and library in cloud vector
00:02:41
will allow us ups in cloud that's how it is
00:02:45
is written vector will allow us to work with vectors
00:02:48
next I have to write a new function
00:02:51
this function is main
00:02:52
and this is the main function in the plus + version
00:02:54
thanks to this function we can generally
00:02:57
run the program if in any
00:02:59
The project C plus plus does not have the made function
00:03:02
accordingly, do not start the project
00:03:03
because at the start of the project it is written
00:03:06
in C plus plus
00:03:07
the main function is executed and everything is out in
00:03:09
this function is executed if not then not
00:03:12
nothing and you must perform the functions
00:03:14
be sure and necessarily key
00:03:16
syllable liquor and return the value 0 .
00:03:19
when we do a bunch of code here
00:03:21
will be and the function will reach the word liquor
00:03:24
it will return the value 0 it will say
00:03:26
to the compiler that the function ended with
00:03:29
and result 0 this result means
00:03:31
what is a function what is the whole program
00:03:33
ended correctly, that is, no
00:03:35
errors resulting from program execution
00:03:37
didn't arise now let's deduce that
00:03:39
or you console I can use for
00:03:41
this is the SEO operator here I go
00:03:44
I’ll just write down a certain word for example
00:03:45
hello world
00:03:47
that is, they usually always start writing like this
00:03:49
any language asked at the gate
00:03:51
matching we did that too in the end
00:03:53
added online this means it's over
00:03:55
lines and transition to a new one but we have
00:03:57
whether there were several errors, the point is
00:03:59
what do we need to use
00:04:01
namespace std
00:04:02
I can solve this in two ways then
00:04:03
there is I can register with t d:: in the light
00:04:07
but write the same thing here with td
00:04:09
:: English then we don’t have any mistakes
00:04:13
everything will be poor, but so is everyone
00:04:15
once writing it's boring it's long it's even
00:04:17
it can't be said correctly so let's
00:04:19
you and I just turnkey it we will
00:04:21
use namespace std this way
00:04:24
I have already
00:04:25
don't write std everywhere here and just
00:04:28
write online CNN we will continue to search
00:04:30
write
00:04:31
Well, and this is the main thing, everything will work
00:04:33
press the wound button here
00:04:35
button you
00:04:36
visual studio is basically the same there
00:04:38
there is a button somewhere that's why that's all and
00:04:42
we see that everything was done for us
00:04:44
hatched successfully hello world
00:04:45
and the program ended with code 0 well
00:04:48
then here it is 0 returned
00:04:49
accordingly there are no errors
00:04:51
arose, it means everything is correct with us
00:04:52
now let's talk about changes in
00:04:55
C language plus plus variables is a certain
00:04:57
cells you yes we can write down
00:04:59
information and then take this information
00:05:01
use it whenever you want
00:05:02
This is how variables are written in C language
00:05:04
plus plus initially we need
00:05:06
specify a data type for some
00:05:08
specific variable exists
00:05:10
several data types for example we
00:05:11
let's look at the very first one with you
00:05:13
data type is char you data type char we
00:05:15
we can only fit one
00:05:16
any symbol, that is, we write
00:05:18
initially data type
00:05:19
then we have to call ours somehow
00:05:22
change, for example, change cannot
00:05:23
start with and numbers
00:05:25
also you don’t need to write in them
00:05:26
initially the first character and indeed
00:05:28
no such symbols and it should be like there
00:05:29
dollar ampersand and the like is the same
00:05:31
the most ordinary normal
00:05:33
names should be given, I’ll name this as an example
00:05:35
sim and further I can and you this variable
00:05:38
immediately set any value to
00:05:40
for example, I’ll ask that it will be simple here
00:05:42
the symbol is just a letter and accordingly here it is
00:05:45
in this way we created change with you
00:05:47
in the future we can refer to this variable
00:05:48
access the seals example and more
00:05:52
just output our variable 7
00:05:54
Accordingly, I simply write 7 I can continue
00:05:56
again, register online so that
00:05:58
everything was then a new line for us
00:05:59
Now, if we run this all, we will see
00:06:02
that we will simply have in the console
00:06:04
hello world displayed
00:06:05
well then this is our our variable
00:06:07
respectively, you and I with the variable
00:06:09
here we figured it out further what else
00:06:11
types exist change it was a type
00:06:13
a chart that we can record on
00:06:14
specifically one speech symbol further we
00:06:17
we can create bull as a variable
00:06:19
which takes two values ​​either true
00:06:21
or false example I can call this
00:06:23
change from quark and for example give it
00:06:26
meaning how difficulty it works
00:06:28
for example, it gives that is, here it’s just
00:06:29
we need an eye of meaning but maybe not
00:06:31
work or can work
00:06:33
true or false respectively
00:06:34
this is the second data type, the third type
00:06:36
data is
00:06:37
for example int int we can write
00:06:39
any integers for example this is one
00:06:41
two three four and so on that is this
00:06:43
ordinary whatever the simplest numbers are
00:06:46
in addition there is long long int in
00:06:49
long int we can just put
00:06:51
greater value than just int itself
00:06:54
for example if
00:06:55
int I can't fit several in there
00:06:57
there are quintillions of millions, I don’t know, yes
00:06:59
then damn kent I can have something like this with me
00:07:01
place the number in this itself
00:07:03
C programming some programs
00:07:05
write difficult things there, or rather it’s not
00:07:07
very often used brittle and therefore
00:07:10
that he has a really big range
00:07:11
for example, if you write large good ones
00:07:13
such projects for us or something like that
00:07:15
spirit of Talon King for example there it is often
00:07:17
may not need large ones
00:07:18
number ranges
00:07:20
but this is the principle of lonking I can’t come here
00:07:21
write and at five we get the name by the way
00:07:24
variables do not need to be repeated
00:07:26
because it was not going to be easy
00:07:27
overlap each other here's one for us
00:07:29
I can put it here in the future
00:07:31
simple and the number 23 is ok but it will be
00:07:34
not really smart because lon canton turns more
00:07:36
it requires more memory so
00:07:39
accordingly it would be easier
00:07:40
use for something like this just int to
00:07:42
for example, or use short int for
00:07:45
ours in our case because we have
00:07:47
here these are very small numbers and
00:07:49
short int is exactly what is used for
00:07:51
Odessa is so small in numbers, well
00:07:53
for example, ours in the case of 120 years of Odessa
00:07:55
we have small numbers below
00:07:57
there is a fleet data type if we can
00:08:00
write only some specific ones
00:08:02
numbers for example there are 12345 then we would have a fleet
00:08:05
we can write an example there for example
00:08:10
favorite number there and for example it will be
00:08:14
equal to 2.35, for example, up to 2.35 we can even
00:08:18
at the end of f it is not necessary to get it
00:08:20
example effect means that float
00:08:22
data type lot but this may not be
00:08:24
you can deliver and write it down without
00:08:25
numbers letters to letters
00:08:28
that is, we would consider the fleet to be recorded
00:08:30
float two 3.35
00:08:34
1.22 there for example or there are some
00:08:36
huge numbers up to that, for example 125
00:08:39
thousand. 345 for example one was talking about this
00:08:42
spirit also exists double double it's like
00:08:44
basically breaking, that is, it doubles
00:08:46
its range is greater than that of float
00:08:48
accordingly, we can simply numbers
00:08:50
write more here for example about food
00:08:52
some kind of test let it be called
00:08:55
and here there is 0 .
00:08:57
and there will be a bunch of some symbols
00:08:59
absolutely fine it will work
00:09:00
correctly
00:09:01
besides, we can also create
00:09:03
For example, I can write these changes
00:09:05
pint next call her oh
00:09:07
and then in other lines assign them
00:09:10
values ​​for example to the next line
00:09:11
I can also assign its value
00:09:13
create constants constants
00:09:15
this is something that will never happen again
00:09:17
change for example if I write a word
00:09:19
const Next I will write, for example, words of words
00:09:22
let it be and I will indicate that this is an api
00:09:25
the value of pi here is for example 3.14
00:09:29
Well, there I no longer remember the numbers and
00:09:31
accordingly, that’s enough in principle, that is
00:09:33
constant we cannot further and
00:09:34
death if variable here I am
00:09:36
assigned the value test well, this one
00:09:38
change with assign values ​​and continue
00:09:39
I can change this value to . n 23.
00:09:42
34 for example it will be absolutely
00:09:45
correctly, then I can display it all in
00:09:47
the console is for and I can’t do it anymore
00:09:49
do it because it would be a mistake
00:09:51
example, I want to put everything here
00:09:52
value 3 then in principle it will indicate
00:09:55
error as you see now let's
00:09:57
let's work on math
00:09:59
operations on variables first
00:10:01
I will create two variables i.e. it will be
00:10:03
we have one and separated by commas I will create more
00:10:06
one change for us 2 respectively like this
00:10:08
you can do it and I do just that
00:10:10
please use it further I'll try
00:10:12
user so that he is the only one for us
00:10:17
for example, this is how I’ll write it further
00:10:19
I will ask the user to do this
00:10:21
really led
00:10:22
for this I use the seedlings operator
00:10:24
Allah he deduces sen he is the opposite
00:10:25
receives information and writes what
00:10:28
variable I write it all down I
00:10:29
I write one further into the nam variable
00:10:32
I'll copy this basically because I
00:10:34
I also want him to lead us 2
00:10:35
do it accordingly and now I
00:10:38
I can produce various
00:10:39
mathematical operations for example I can
00:10:42
create another integer let's create it
00:10:44
I'll put the rolls here and I'll call it
00:10:47
passed by
00:10:48
this is what he will do for example
00:10:50
section will take value to 1
00:10:53
plus us 2 accordingly it will be
00:10:55
adding these two numbers for example
00:10:58
if I then try to bring it to
00:11:00
screen
00:11:01
then we get the following let's go here
00:11:03
I'll describe the blast from
00:11:05
and here we’ll just add for example
00:11:09
additional results and basically that's all
00:11:11
let's compile and see what comes out
00:11:14
this is what we got so for a start
00:11:16
he see as an intern one I drive for example
00:11:20
23 then we get 234 and now we get
00:11:23
result 57 additional variables
00:11:26
can subtract multiply divide receive
00:11:28
remainder when dividing, for example, I ran
00:11:30
program let's enter the first number 12
00:11:33
On the 2nd I will have 23 for example and if
00:11:36
look, they're not all that strong
00:11:37
all these conditions are met correctly
00:11:39
and the remainder of the division is also satisfied
00:11:41
absolutely correct but look at what
00:11:43
there is also a little thing here when
00:11:45
12 divided by 23 then we get the result 0
00:11:49
why does this happen the thing is that
00:11:51
us that all these changes are ours
00:11:54
are them accordingly he cannot
00:11:56
write 0 there.
00:11:57
and then there is some number or 1.5 it
00:12:00
can't make them into a fleet type
00:12:02
accordingly how we do it
00:12:04
we can solve this problem with you
00:12:06
we can solve this as follows:
00:12:08
for example, where the divisions are, I’ll add one more
00:12:10
a new variable let it be well
00:12:13
let it just be called rez
00:12:15
nothing more here
00:12:16
I will describe now where do we have division here?
00:12:18
I will not record the divorce from
00:12:20
variable once and now I will
00:12:22
use
00:12:23
cast these values ​​to fleet type
00:12:26
accordingly we will have this now
00:12:28
like the fleet we will also have it like but
00:12:31
now we divide the fleet by the fleet we get
00:12:33
again, the fleet is here and we are taking it out
00:12:36
just on the screen so we get the result 0 . 520 and
00:12:40
went further there accordingly
00:12:42
we are really a fleet, we take out the floor
00:12:44
and then everything works correctly for us
00:12:45
in addition we can produce
00:12:47
various mathematical operations on
00:12:49
the most changes, for example, if we
00:12:51
there is a variable let it be for us
00:12:53
one and to this variable we want
00:12:56
add a number, that is, we have one plus
00:12:58
for example there is 23 we of course can and
00:13:01
so write it all down absolutely
00:13:02
correct but we can shorten we can
00:13:04
add this plus equals 23 means that
00:13:07
to this variable we add the number 23
00:13:10
we can also subtract this number we
00:13:11
we can multiply
00:13:12
divide this number and get the remainder
00:13:14
when divided by the same number
00:13:16
that is, it turns out we take the same number
00:13:19
he has the rest of his definitions for this
00:13:21
here is the number according to this
00:13:23
In this way this is additionally possible
00:13:24
implement in addition if you want
00:13:26
add one to any number
00:13:28
example + 1 then you can do more
00:13:30
It’s easier just by writing + + and
00:13:33
accordingly this means that
00:13:34
adds one to this variable or
00:13:36
if you write minus minus then this is
00:13:38
will mean that you take away one
00:13:40
this variable now let's
00:13:42
Let's look at conditional statements with you
00:13:44
thanks to the conditional operator we can
00:13:46
perform any action in
00:13:48
depending on what values ​​we
00:13:50
got an example let's you and me
00:13:51
let's create a new change it will flow and
00:13:54
we wouldn't get this HS from
00:13:56
user, that is, he would enter them
00:13:57
we need this change accordingly further I
00:13:59
I want to check this change, that is, I
00:14:01
writing
00:14:02
iv h if she something our when
00:14:04
variable h then we write some
00:14:06
condition that is if our thing is
00:14:09
more than 18 for example thanks
00:14:11
to this we indicate that we also
00:14:13
we can indicate that, for example, less is less
00:14:15
either equal to greater than or equal to this
00:14:18
greater than or equal to simply equal to or
00:14:21
it doesn’t matter that all of them are here, conditional
00:14:23
operations in our case I need
00:14:25
just more if more than 18 then I
00:14:29
let's just write something like this
00:14:31
What
00:14:34
avoid here there is some mistake there
00:14:38
beat me up for it, so let's just give the rating
00:14:42
I'll put everything else here
00:14:43
I won’t additionally record online
00:14:46
ok that is, if we add more than 18
00:14:49
further I can additional condition
00:14:50
enter 1 is not mandatory but
00:14:53
I can write that is lcf if h
00:14:56
will be equal to 18 for example then I let's
00:14:59
I’ll write research, I’ll just copy it
00:15:02
and the example which is equal equal in my opinion
00:15:07
it's spelled like this, that is, your age
00:15:09
equals 18 and if
00:15:12
and I can still provide additional conditions
00:15:13
add which is executed by
00:15:16
default if all other conditions are not
00:15:17
executed, that is, for example, this is lc
00:15:19
if this condition returned a fall then
00:15:22
is not true it is also
00:15:25
It’s not true that all these are executed by lc
00:15:28
el-si-el silver they are
00:15:29
optional ones you can do without them
00:15:31
just write to them and it's all done
00:15:33
there will be a check but if we want we can
00:15:35
add more lc and if we want we can
00:15:38
again you can add a little lc
00:15:40
add wasps just iv that is like this
00:15:42
write it down and it will be absolutely
00:15:44
correct and correct lc is executed in
00:15:46
otherwise, if everyone else
00:15:48
checks have not been verified essentially yes
00:15:51
that is, it is no more than 18 but not equal
00:15:54
18 which means she is something else so I
00:15:57
I can still write that the speech is from us
00:16:01
this means your age is less than 18
00:16:05
For example, if you run it all and enter
00:16:08
number but any absolute number is now only
00:16:11
but here it will load, using my example
00:16:13
I’ll write down the number 17 then the speech is cut up then
00:16:17
that is, your age is absolutely less than 18
00:16:19
all checks were correct and it's simple
00:16:22
great besides I can do these lc
00:16:24
ip here add a huge amount
00:16:26
I can add 11 more for example if I
00:16:28
I will if the age is 17 then I will
00:16:32
I’ll write, for example, that it’s yours
00:16:34
age hurts 17 respectively not really
00:16:36
I changed a lot of things but still here
00:16:38
you can of course write down whatever you like
00:16:40
only checks what kind of
00:16:43
only you can always insert the code in these
00:16:44
the checks themselves, that is, for example
00:16:46
I can put some more here
00:16:48
check for example if my age is
00:16:50
17 here and in addition I will create one more
00:16:53
change it will be happy variable
00:16:55
which by default will be equal to
00:16:58
difficulty let it be true immediately and
00:17:00
and in principle I will check for it
00:17:02
how can I check for bully
00:17:04
that is, these are the variables I can
00:17:06
just write is happy equals true this
00:17:08
will mean that if happy is true
00:17:10
then I will output, for example, but let me not
00:17:13
this text will display the text
00:17:15
the next one is now its mode and I’ll paste it here
00:17:18
can't you you a happy that's basically yes
00:17:23
Let's just write what's happening here
00:17:26
look we are checking
00:17:28
we if our age is 17 nights
00:17:30
let's go into this whole check and into this whole
00:17:32
code in this whole body
00:17:35
checks that's what we check here if
00:17:38
is happy equals true then we will be
00:17:41
just display something like this on the screen
00:17:44
that you are happy
00:17:45
if he doesn’t work, then this is a test
00:17:49
will not work and will be executed accordingly
00:17:51
just this one line of code why
00:17:53
it will be fulfilled because it is not
00:17:54
refers to this condition she she does not
00:17:56
were poked does not affect the meaning of this
00:17:58
conditions for this line of code
00:18:00
why didn't I finish it here?
00:18:02
brackets the thing is that when we have one
00:18:04
line of code for example there are more of us here
00:18:06
one line of code to install with us too
00:18:08
there was one line of code on there I
00:18:10
I just already added these brackets but if
00:18:12
us one line of code then we can not
00:18:13
putting these parentheses will do it
00:18:15
absolutely normal now one more thing if
00:18:18
we check by type so
00:18:20
the variable is equal to labor there then we can
00:18:22
I can write it all down in a simpler way
00:18:24
write to them and the diagram, that is, if
00:18:27
our change how to paint is like this
00:18:29
we can say this means that we
00:18:31
just checking is happy equals true
00:18:33
this is the equivalent because we
00:18:35
just wrote if I want to check
00:18:37
I just bet on the fact that she falls
00:18:39
sign ! pass it on
00:18:40
and this variable and we are already checking
00:18:42
but is it equal to canvas, that is, it was
00:18:45
would be equivalent to falls that is, is it equal
00:18:48
this is a variable the variable is set to false here
00:18:51
accordingly, let me write this
00:18:52
now the meaning of the post is again yes that's it
00:18:55
Let's compile and try to write here
00:18:57
the number is 17 and we see that you were engaged
00:18:59
exclusively this line because
00:19:01
that this test failed
00:19:02
Accordingly, nothing came out here
00:19:04
if I wrote here that we have a corpse
00:19:06
then accordingly enter here again
00:19:08
17 we already have two lines displayed and a
00:19:11
happy
00:19:12
and you're 17, that's all
00:19:15
great besides we can
00:19:17
combine several checks for example
00:19:19
if we want to check here not only
00:19:22
that these are more than 18 but still some
00:19:24
we will put an additional check
00:19:25
we can write it like this, that is, it means
00:19:27
what if h you are more than 18 and ours
00:19:32
2 conditions for example is happy that is if
00:19:35
age will be over 18 and we are still
00:19:38
supplement
00:19:39
funny then just do this
00:19:41
here is a condition for example if we have at least one
00:19:43
of these and at least one of these conditions
00:19:45
will return the canvas but it still doesn’t work for us
00:19:47
will be in plan
00:19:48
this test will fail
00:19:50
for example I return the values ​​I set
00:19:52
value 17 and as we see again too
00:19:55
what happened is we didn't check
00:19:57
it worked because we don't have a speech
00:19:59
more than 18 if I bet
00:20:01
for example, we will already have 19 o'clock then how
00:20:04
since this whole test went like this
00:20:07
true because we both have both conditions
00:20:09
are true, that is, it is a corpse and
00:20:12
this is a corpse if I want to check for that
00:20:15
so that one of the conditions is 3d
00:20:17
I can put it or does this mean something
00:20:20
this condition must be true either
00:20:23
this condition must be true then
00:20:25
the whole body is performed this this this
00:20:27
conditions accordingly if I still
00:20:30
I’ll run it once and now I already have in mind the number k
00:20:32
example 17 then we get the following:
00:20:36
speech and speaker at the why because summit
00:20:38
this is fall this is not tested for this
00:20:41
passed the test because it's a corpse here
00:20:44
and accordingly to us and when we become
00:20:45
or do we need at least one
00:20:48
go to the condition was with the value true
00:20:51
such additional checks we
00:20:52
we can put a bunch here, that is
00:20:54
enter even more and more of these
00:20:56
checks for various changes, etc.
00:20:57
similar there is another conditional
00:21:00
operator it's called candles, it's written
00:21:03
as follows, switch is written here and
00:21:05
then a case of some condition is written
00:21:07
so first of all, let's have some more
00:21:09
let's create one variable it will be for us and
00:21:11
I'll give it a value of 12 for example
00:21:14
now you switch
00:21:15
I write a variable that I will
00:21:17
check I will check the variable on
00:21:19
I will check for certain values
00:21:21
example case 1, that is, the first case is me
00:21:23
I check if it is equal to one then
00:21:26
I will fulfill the following condition
00:21:28
In addition, this case requires
00:21:30
write break so that we can
00:21:32
but this is an example, these are the brackets for
00:21:35
so that we can understand in order
00:21:37
so that the compiler can understand where
00:21:38
ends here is the data in case given
00:21:40
check because if it's not
00:21:42
it's easy to register
00:21:44
the following will be executed
00:21:45
cases that means here I am just when
00:21:48
So I check if, for example, it’s ours
00:21:51
the variable will be equal to one then
00:21:53
perform the following operations for example
00:21:55
seoul and here I'm just one of us
00:21:59
example and nothing more to add here
00:22:01
I won't go any further, I can do it here
00:22:03
put as many of these as you like
00:22:05
okay, but there is a case 2, for example, we are out of 20
00:22:08
basically I'm just here already
00:22:09
I’ll just make it for us out of 3, so here’s what to do next
00:22:12
Of course you can add a bunch here
00:22:14
various code and place all this code
00:22:16
before the word take because break it
00:22:18
indicates that all this case is completed
00:22:20
7 that is, for example, for us it will be equal to
00:22:22
three that means we're coming here
00:22:24
he checked that she was not one not two
00:22:27
here are 3 yes it's really her
00:22:29
he executed this line of code and exited
00:22:31
from here it's all over, for example I
00:22:34
also exists, remember we are with you
00:22:36
just wrote lc this is also
00:22:39
there is a default, that is, it is something
00:22:41
value that is fulfilled by
00:22:42
by default for example here let's give it
00:22:44
myself too, just one line for example
00:22:47
here I’ll just write what we’ll have
00:22:49
us from a but he because for example I
00:22:52
Odessa residents don’t know about her default, maybe not
00:22:55
write this default value which
00:22:57
you can add or not add
00:22:58
for example if you don't have any
00:23:01
values ​​about which you need to add
00:23:03
default if all the main ones are from and not
00:23:04
worked the default maybe not like that
00:23:07
example, if all this is allowed, then we have
00:23:09
the next one will be completed for us from 30+
00:23:11
programs there further in one line
00:23:13
registered because I didn't add
00:23:14
here online that is basically here
00:23:16
it was all very very simple
00:23:18
in addition there is also
00:23:20
simplified verification form for example
00:23:22
let's create an int bull for them
00:23:26
oh I'm sorry and I wanted to create this
00:23:28
bull and sports example I'll call her and she
00:23:32
will be equal to the following for example I'm here
00:23:34
I check for some immediate condition, for example
00:23:37
if 1 is equal to one then we
00:23:41
we put the work in principle here
00:23:43
otherwise we put falls that is what is here
00:23:45
happens initially we write the conditions
00:23:47
then we put a question mark and write
00:23:50
if labor animals when if this condition
00:23:53
there is no truth when this is done
00:23:55
if it is not true then it is executed
00:23:58
this is according to my case this
00:24:00
will just be displayed just will be delivered
00:24:03
destination and swarg true to be
00:24:05
placed besides because here
00:24:07
the broth is used basically I just
00:24:09
I can write 1 is equal to one and Anapa
00:24:12
write here or it’s truly pathetic
00:24:14
I was about to report wow better
00:24:16
for example int will be here again for us
00:24:18
for example if 1 is equal to one started in the wrong place
00:24:22
write who we are for example if 1 is equal
00:24:24
to one then we set the value 12 otherwise we
00:24:27
set the value to 23 examples then
00:24:29
in the same sense and even more so
00:24:31
accordingly, and so simple
00:24:33
simplified form of checking for conditions
00:24:35
some now let's talk about arrays
00:24:37
Maxim and we can put a lot
00:24:39
information can basically interact
00:24:40
with this information in order to
00:24:42
we need to create an array
00:24:44
again, specify the data type here
00:24:46
the same types as for variables then
00:24:48
there is in the double charm and the like
00:24:51
for example I'll just create
00:24:52
for example int array with data type and
00:24:55
then I have to call him whatever you want
00:24:58
for example I'll call it
00:24:59
and ray because from English and Wright
00:25:00
the mass further I have to put these
00:25:02
square brackets and basically indicate
00:25:04
number of elements in this array
00:25:06
example my elemi in my array would be
00:25:08
just four elements
00:25:10
accordingly, in this way I created with
00:25:12
you array it is still exactly the same as
00:25:14
you and I have created changes and so far
00:25:16
we don't call for no value, it's just
00:25:17
dummy here everything is the same for that
00:25:20
to add some value to
00:25:22
this array
00:25:23
I take this raid array by name further
00:25:26
old square brackets and indicate
00:25:28
index of the elements we want
00:25:29
write the value in the array from the index
00:25:32
starts from zero, that is, the first
00:25:34
element is the second element zero
00:25:36
element is the first element and so on
00:25:38
further, that is, 0 1 2 3 we only have
00:25:41
it turns out three elements 4 elements as
00:25:43
there is no such thing because we start with
00:25:44
zero countdown
00:25:46
respectively next to first
00:25:47
element something to put I just
00:25:49
I set raid 0 and it is listed here for example
00:25:51
the number is 23 because we have an integer
00:25:53
data type is inject and I can only read
00:25:56
write integers 2313 and so on
00:25:59
if I had indicated that it was in words, for example
00:26:01
then I could write it down to 23.20 for example
00:26:05
now how to work with all this again
00:26:06
the same as with a regular one as with a regular one
00:26:10
variable, that is, we simply take again
00:26:13
food of the seas
00:26:14
next we indicate we will set square
00:26:16
brackets specifying which element we want
00:26:18
For example, I want to bring it up in my case
00:26:19
output the first element because it is like
00:26:21
times so many other elements are recorded
00:26:24
since there is no more, let's launch the program
00:26:26
and let's see what we have
00:26:27
it worked and we will basically get it
00:26:29
just show the number 23 on the screen. 23 that is
00:26:34
really what we wrote down is
00:26:35
output, in addition, arrays can also be
00:26:38
initiate differently, that is, to
00:26:40
for example, let's create more
00:26:41
one array
00:26:42
it will be called simply or let in
00:26:44
we will have three elements
00:26:46
just and we can do it right away
00:26:48
project that is, write down everything
00:26:50
absolutely here values ​​for example 2356 and
00:26:53
letting in 12 will be like this we
00:26:55
immediately wrote down all the values ​​​​in it
00:26:57
three elements and now again we
00:26:59
we can discuss working with them normally
00:27:00
besides, you and I wrote one-dimensional
00:27:02
arrays can be written two-dimensional 3
00:27:05
three-dimensional and so on, respectively, in
00:27:07
what will be the difference between them if one-dimensional
00:27:09
array it only has meaning in itself
00:27:12
any numbers there for example or this
00:27:14
some symbols and the like
00:27:16
two-dimensional array
00:27:18
it consists of arrays like
00:27:20
look, we will have an array
00:27:22
are 1 array consists of three
00:27:25
elements and already the second array every year
00:27:28
massive inside this array will be
00:27:29
consist of two elements what is it
00:27:31
means for example here we had
00:27:32
number 23
00:27:33
in our case, these will no longer be numbers, but
00:27:35
some other array and this array
00:27:37
consists of two elements, for example 2312
00:27:40
the next element is exactly the same
00:27:42
him too this is also an array and he also
00:27:45
consists of two numbers from two elements
00:27:47
Bernini numbers are just elements here
00:27:50
maybe there could be completely different ones
00:27:51
values ​​for example 45 78 and the third element
00:27:54
absolutely the same thing, that is, a cave
00:27:57
I’ll close this, that is, for example, the 67th here
00:28:00
three for example all
00:28:01
so we created with you
00:28:03
a two-dimensional array is a three-dimensional array
00:28:05
when still in place of these
00:28:06
there are still other massive ones that are already
00:28:08
we're going too far ahead
00:28:10
three-dimensional mass is no longer so common
00:28:11
used even more or less on
00:28:13
three-dimensional is real so it hurts me
00:28:15
rarely used world 4
00:28:17
especially since it’s like this with them now
00:28:20
working with them is very easy
00:28:22
absolutely the same array just now
00:28:23
instead of one index here, for example, 0
00:28:25
I indicated yes and that’s kind of what I’m saying
00:28:28
first array I must also
00:28:29
show the second array which we
00:28:31
let's address that is, initially I
00:28:33
accessing the element at index 0 is
00:28:35
this is our element and in this element
00:28:38
I also take it into the array and I also take it into the array.
00:28:41
I take another element here too
00:28:43
everything starts from scratch without counting, for example I
00:28:45
I'll put a 1, it means that I
00:28:46
Initially I take the zero element here
00:28:49
all and then I take the first element by
00:28:51
the first index yes that is
00:28:52
accordingly, this is the one we will have
00:28:53
element if this is all try to display
00:28:55
then we will really get
00:28:57
console number 12 here it is displayed
00:29:00
this way you can work with arrays
00:29:02
in their si plus plus
00:29:03
now we will create a loop and
00:29:05
initially we will work with a loop
00:29:07
for and in this cycle we place our new
00:29:09
change oh that is, we initially
00:29:11
indicate what date we all start from
00:29:14
that is, and initially we will have equal
00:29:16
zero we are all this whole cycle will be
00:29:18
work until it is less than 10 then
00:29:21
there while she is there 1234 she will be this
00:29:25
the loop will run
00:29:26
and the third parameters we will indicate that we are with
00:29:28
each iteration
00:29:30
we will increase ours and ours in our change
00:29:33
oh per unit respectively there are 1 of us
00:29:35
cooperation it will be 1 next it will be
00:29:37
byte so further example I will output
00:29:39
just on this screen this is our value and
00:29:42
and accordingly we will see what we have from
00:29:44
zero to nine all all the numbers will be
00:29:47
the battle console has been removed from the year they are from zero to
00:29:49
nine absolutely all withdrawn
00:29:51
accordingly, what if I write for example
00:29:53
here is also the same as their conditional ones
00:29:55
operators, for example, if we write here
00:29:57
greater than or equal to there debo greater than or
00:30:00
equal less or equal and so on until s
00:30:02
for example less than or equal to then we will notice
00:30:04
that from zero to ten everything will work out for us
00:30:06
meanings and for example if giving
00:30:08
stood that here we start with
00:30:09
We only have a few at all
00:30:11
ideally it would be from one to 10
00:30:13
heart numbers you came
00:30:14
Well, it’s clear here, you can do it all like this
00:30:16
I can improve the example if you want
00:30:18
write here that initially and the fault with
00:30:20
Peter by 100 and we will do it all
00:30:22
carry out until we have no more
00:30:24
or equal to 10 that is, while she is there
00:30:27
199 80 and so on we will be all of this
00:30:30
fulfill and of course already
00:30:32
it is necessary not to increase but vice versa
00:30:33
reduce but I will reduce it
00:30:35
also by department, that is, I every time
00:30:38
I will divide oh by two accordingly
00:30:40
there will be quite a few values ​​and
00:30:42
exactly 150 25 and 12 and note again
00:30:46
12 is output there should have been output
00:30:48
only 12. 12 and a half came out wrong
00:30:51
because we just have it because we have
00:30:54
us exactly and this is int if in this
00:30:58
In this case, it would be more correct to write that
00:31:00
This is our chlorine
00:31:01
because we are still at 2 all the time
00:31:03
divide accordingly it would be 12 s
00:31:04
half that is the for loop I think here
00:31:06
nothing complicated, absolutely simple
00:31:08
a cycle that looks like this
00:31:09
is implemented in this way in principle
00:31:12
the next loop is running this loop is wild in
00:31:15
in this cycle everything is basically the same
00:31:17
there are only a few happening here
00:31:18
Firstly, we have some differences
00:31:20
variable a and which is moved out of the loop
00:31:22
for example, it is equal to zero, then we all
00:31:25
we will do this until we have
00:31:27
less than ten and in the cycle itself we and
00:31:29
let's increase it by 2, we can
00:31:31
also increase by one for example
00:31:33
for diversity we will already increase
00:31:35
her for two respectively and I'm still here
00:31:38
I will issue additional information
00:31:39
online this is what I’ll comment on so that
00:31:41
she just didn’t bother me further
00:31:43
now if I try to deduce all this then
00:31:45
we get 0 2 4 6 8
00:31:48
if we also put equal here for example
00:31:50
10 then it would also come out 10 for example then
00:31:52
the principle is the same, just different
00:31:55
is that he has a bail cycle
00:31:58
and a little bit of all these meanings for everything
00:32:00
the values ​​are scattered, that is, oh we need to
00:32:03
create in a loop then check and
00:32:06
cycle further increase this value oh
00:32:08
but nevertheless the wild cycle was very
00:32:11
in many cases it is much more useful
00:32:13
than there was a cycle in general, perhaps many
00:32:16
do things you can't do with
00:32:18
in the future you will get more using the for loop
00:32:20
understand but the main thing is to understand and you know
00:32:22
that there is such a cycle as wild now
00:32:24
there is also a third loop, the do loop
00:32:27
while, in principle, how is it different?
00:32:30
the fact is that we have all these cycles
00:32:31
for ivaylo are not executed exclusively
00:32:33
if our conditions are true that is, if
00:32:36
us terms and conditions is true
00:32:38
you are here for example ah more equals 10 or
00:32:40
here a and less is equal to 10 then we have this
00:32:42
the cycle runs I think it even if
00:32:45
condition won't return on it doesn't matter
00:32:47
executed at least once therefore
00:32:49
if I write here again for example
00:32:51
and I let go it will be j200 a second j
00:32:56
here let the Nazgul j of a new change and
00:32:58
if, for example, it is equal initially
00:33:01
100 we will check for conditions until jay
00:33:03
again and
00:33:05
sorry bye jay jay jay jay
00:33:09
our Jay will be smaller than for example
00:33:13
I don't know less than ten for example and
00:33:16
here I'll just output j and we'll
00:33:18
we can immediately notice that we have conditions
00:33:20
the gas is not initially correct in the cycle
00:33:22
nothing to come in at all but since we
00:33:24
I thought such a cycle then once it
00:33:27
compulsory, therefore we have
00:33:28
the output is one operation
00:33:31
passes we get this one of ours
00:33:33
Jay, accordingly, is found in the console
00:33:35
100 and then this condition is checked but
00:33:37
turns out to be incorrect accordingly
00:33:39
we are no longer entering this cycle if
00:33:41
she was true only to the example we would
00:33:42
you came back, it was already a cycle
00:33:44
would be the most ordinary cycle
00:33:46
for example, the same shaft here, respectively
00:33:48
this third cycle which exists in
00:33:50
version plus plus thanks to the cycle very
00:33:54
It’s convenient to recalculate an array, for example
00:33:56
we have a certain array and for example it has
00:33:58
there are two elements there and we, for example
00:34:01
we initiate them immediately or let you know
00:34:03
we've already had some more than once
00:34:06
int let's it be char for example this
00:34:08
there will be some kind, for example, and there will also be
00:34:10
for example, now I can thanks
00:34:13
for example, I didn’t think about the cycle, let it be
00:34:15
omitting for I will not use
00:34:17
I like it in the steam room, it’s a simple principle
00:34:19
it will be ideal for cycles
00:34:20
suit
00:34:21
accordingly here I will have int and
00:34:23
starts from 0 it will be less than two
00:34:27
element in principle that is 0 1 element
00:34:29
here and here
00:34:30
oh plus plus, respectively, everything that is
00:34:32
now I'll do it display our
00:34:34
array
00:34:35
I take or that is, this is our array to
00:34:37
index and in this way now
00:34:40
when I launch all this we will notice that we
00:34:42
the console will display a second with and a
00:34:45
well, accordingly, that is, absolutely
00:34:47
everything works correctly
00:34:48
this way all the elements are much simpler
00:34:51
display the array on the screen or learn how
00:34:53
traders of these array elements rather than
00:34:55
take one element at a time and something with
00:34:57
do this element if you have previously
00:34:59
studied the Situ language, you may have noticed that
00:35:01
in this language there is no such thing as
00:35:03
strings in C language plus plus above this already
00:35:06
worked a little and accordingly
00:35:08
there is such a data type as strict
00:35:10
it is not built-in, that is, it is a data type
00:35:12
which here we are a penny we are with you it
00:35:14
connected the string, but still no pictures
00:35:17
you can work less and work very much
00:35:19
It’s just that in the C language it was just a data type
00:35:23
char that is when we can write
00:35:25
like y or any one character here
00:35:27
plus plus plus basically the same thing
00:35:29
is we can write an array of without
00:35:33
symbols, for example, we’ll do it here
00:35:36
an array of 6 characters and approximately we write
00:35:39
his words are a quarrel, that is, everyone every
00:35:41
symbol this is one element
00:35:43
array
00:35:44
accordingly we get something
00:35:46
word and in principle it can be called
00:35:48
string but if we want to use
00:35:50
lines in the future are of course not convenient
00:35:53
write it all down in this way, that is
00:35:55
creating an array of characters is inconvenient
00:35:57
and so you si plus plus is huge
00:36:00
the plus is that to the residents of Odessa we
00:36:03
we can use just strings
00:36:04
how can we use
00:36:06
strictly again, we connected with you and
00:36:08
string library string means I can
00:36:10
feel free to write a data type like
00:36:12
string and this is basically the same thing
00:36:15
essentially it plays the same role to
00:36:17
for example char or something like that
00:36:19
yes there you are and so on it’s like a type
00:36:21
data that is string and then we write
00:36:24
for example hello
00:36:25
I will name this variable as halu and
00:36:26
Now I can do just these doubles
00:36:29
in quotation marks
00:36:30
put any any any phrase
00:36:34
principle to draw up which is usually
00:36:35
write low
00:36:36
well, simply because they have more strength
00:36:38
I won’t write anything at all, for example
00:36:40
seal now I’ll display it all on the screen
00:36:42
I'm just writing hello here
00:36:45
and online ok if this is all to run then
00:36:48
we will notice that we will simply be taken out
00:36:50
really the words hello and this
00:36:52
indeed absolutely so that is
00:36:54
Hello just came out and you see here
00:36:56
here it emphasized all this just in case
00:36:58
case I'll just say it's not
00:37:00
sh ip it just means that we have
00:37:02
it's that we created an array but it's nowhere
00:37:04
used, that is, and why do we use it?
00:37:06
maybe it wasn’t created there
00:37:08
create this, it's as simple as that
00:37:09
a warning is not an error so here it is
00:37:12
if I want some more lines, for example
00:37:14
create examples I will write more agarron
00:37:16
the name and here we will have
00:37:18
world then accordingly I can do this later
00:37:20
how to combine these lines
00:37:22
I write hello and then I write world world
00:37:26
so it's exactly the same as
00:37:28
and with numbers, for example, when we are 2 plus 5
00:37:31
added and got m here absolutely
00:37:33
the same thing, but plus we get something like this
00:37:36
that's why there's nothing right without a space
00:37:38
let's do a little more
00:37:40
Let's improve this all, for example I
00:37:41
I'll put it here
00:37:43
space here and now I’ll display it like this
00:37:46
way but if you use the plus sign
00:37:48
then basically this is adding rows
00:37:51
exactly so she's like one of the numbers for me
00:37:53
everything is happening now let's talk
00:37:55
I already mentioned about Victor
00:37:57
library vector accordingly I can
00:37:59
Now it’s easy to work with indicators
00:38:00
in order to work with vectors we
00:38:03
you will need to write down the following
00:38:04
initially we write the keyword
00:38:06
vector then specify the type, for example int
00:38:09
no space needed here is the name
00:38:11
For example, I will simply write this vector
00:38:13
object and then I indicate how much
00:38:15
elements will be in this vector for example
00:38:17
initially let there be 10 10 elements
00:38:19
what is the difference between vector
00:38:22
and an array if you use an array
00:38:24
creation we say that there will be five
00:38:26
elements right down to the language itself
00:38:29
the very end of the program in this array
00:38:31
there will be five elements we can't help but
00:38:32
do not add a sixth element there
00:38:34
not 7 not 4 do or methods
00:38:36
the number of five elements is here you are
00:38:39
vectors we can this we can
00:38:41
stretch the number of these elements then
00:38:44
there is for example initially a meta we have 10 of them
00:38:46
I point out that initially I kind of plan
00:38:49
put 10 here but at the same time if I
00:38:50
I’ll want to change the snakes during the program
00:38:53
add this value there too
00:38:54
additional values ​​new elements
00:38:56
then I can stretch this vector that is
00:38:58
to byte there won’t be 10 elements, but for example
00:39:01
20 elements means the following is what we
00:39:03
we do I create an additional new one
00:39:05
array I'll call it ray
00:39:07
it will have three element launches at once
00:39:09
We’ll put 3 elements here, that is
00:39:11
for example we have these
00:39:12
elements now let's place our
00:39:15
you are the new one and what are the vector arrays like?
00:39:17
the way I can do this is I write an object
00:39:20
Next I use the function inside this
00:39:23
the function just allows us to insert
00:39:25
vector in the world arrays vector originally
00:39:29
I say where I will paste this
00:39:31
an array, that is, I would insert it
00:39:32
the beginning of our vector accordingly
00:39:35
begin run begin here I go next
00:39:37
what vector am I what array am I inserting
00:39:40
this is an array called or and
00:39:43
then I say what I want to deliver
00:39:45
just maybe two elements
00:39:47
accordingly it will be 2334 no longer
00:39:50
I want to add no elements here
00:39:51
now what can I do I can withdraw
00:39:53
this massive thing is very
00:39:56
element from vector to screen for example
00:39:59
how do I write SEO next I write
00:40:01
object and then I, for example, indicate
00:40:05
I use the function from ups ups ups ups ups
00:40:08
the function is in this function in principle
00:40:12
I need to indicate
00:40:14
the index that I want to display Yandex
00:40:16
elements that I want example sheet
00:40:18
I want to display the element at index 1 then
00:40:20
there it will be 34 we are only two elements
00:40:23
they gave me these
00:40:24
threw it in and basically added more
00:40:26
online accordingly close all this
00:40:29
and I ended up running the entire program
00:40:31
I will notice that it will be displayed on my screen
00:40:33
number 34
00:40:35
that is, you are a vector, we added our array
00:40:38
just two elements and thus
00:40:40
and additionally they were able to deduce
00:40:42
one of these elements besides vector
00:40:45
I can insert different numbers myself
00:40:47
just for example again 8gb
00:40:49
begin that is the beginning and in place of the second
00:40:52
elements, that is, plus two elements when
00:40:54
on the third element I will insert a number
00:40:56
and acceptable I’ll just put a number here
00:40:58
23 respectively by index and now
00:41:01
I'll take it according to the second index we have earlier
00:41:05
it wasn't even a number accordingly
00:41:07
then our new 23 was inserted here and
00:41:09
everything is ready besides I can also take
00:41:12
insert object or rather not even so
00:41:15
sorry back let me take this one
00:41:18
function and just insert something
00:41:20
value for example in my startup case
00:41:22
will be 45 and that means that I'm taking in
00:41:25
at the very end I put this vector new
00:41:27
value for example 45 now I will
00:41:30
display this last value
00:41:32
style for this I use function b a
00:41:34
This is the function that displays the last one
00:41:36
the value in the vector accordingly in mine
00:41:38
in this case it will display just 45 here
00:41:41
see 45 has really grown
00:41:43
if I wanted to output the first value
00:41:44
then I would use the front function and
00:41:46
then the number 23 would be displayed on the screen and this is
00:41:50
we really have it that way
00:41:52
for example here 20 now let's
00:41:53
let's talk about functions thanks to functions
00:41:55
we can perform
00:41:56
we can derive some from our
00:41:59
main function main and basically
00:42:01
just refer to some functions and already
00:42:03
don't rewrite code
00:42:05
that is, for example, let's mine you and I
00:42:07
let's create a new function it will be with and
00:42:09
the data type is howling, that is, this function
00:42:11
returns nothing
00:42:13
every function needs something and maker
00:42:15
not any data type i.e.
00:42:17
for example our main function has type
00:42:19
data hand why because she
00:42:21
returns an integer value
00:42:23
this is really 0 and this is an integer
00:42:25
number that's why it doesn't have my function
00:42:28
There are no refunds at this time
00:42:30
she will just write on the screen
00:42:32
some some meaning that we will not
00:42:36
and we wouldn’t throw it here
00:42:37
pass parameters and see
00:42:39
important point i function and noise above
00:42:42
functions
00:42:43
main in this way when there is a program
00:42:45
run compiler see ours here
00:42:48
these are the functions and if I
00:42:50
you use the main function to call
00:42:53
these functions tone he will understand that
00:42:54
they really exist it's important
00:42:56
moment it means that and doing yourself would
00:42:59
pass the parameter it will be string
00:43:01
because again the library is up to me
00:43:03
the string is still connected then I will myself
00:43:05
just pass any keyword
00:43:07
some words and which I will display on
00:43:09
the screen has sat down and here I will describe the word
00:43:13
here we go online, let more and more come here
00:43:16
I won’t write anything additional later
00:43:17
now how can I what
00:43:19
to refer I just write the name of the function
00:43:21
it's called print and I put it in it
00:43:24
a certain word in my case is
00:43:26
one parameter is really needed
00:43:28
put this with data type string
00:43:31
accordingly it will be a string for example
00:43:32
I'll write Hello World here like this
00:43:36
In addition, I can
00:43:38
pass the parameter directly like this
00:43:39
I can pass it through a variable, that is
00:43:41
for example, here again a certain one has been created
00:43:43
string so I’ll name it, for example, I don’t know
00:43:47
what to call it on let it be and in
00:43:50
I'll put it in Hello World now I can
00:43:52
just convey for example change
00:43:53
accordingly, if I try something like this
00:43:55
display on the screen then we will notice that we
00:43:57
everything is absolutely true with you we are just
00:43:59
written hello world
00:44:01
at least we don’t have any main functions
00:44:03
simau so no, that is, everything would work
00:44:06
functions at
00:44:07
that's cool besides we can create
00:44:09
other functions, let us give you an example
00:44:11
let's create a function that will
00:44:12
return the divisor number of the definition then
00:44:16
there is for example I will call it gave and this
00:44:18
there will be two in it we will transmit
00:44:20
parameter this will be fleet a
00:44:23
and the fleet used, that is, these are 2 cups
00:44:26
flatbed
00:44:27
here are two parameters and what we will do
00:44:29
already since us we since we
00:44:31
we pass the type of some data, that is
00:44:33
she already has to give it away
00:44:35
function we must have
00:44:37
should be a keyword like
00:44:38
lifting we return the value
00:44:40
means food actor a divided by b and
00:44:45
we need to do some checking here
00:44:46
because if, for example, we have a
00:44:48
is zero then we cannot divide by
00:44:51
zero or rather here b is zero then we
00:44:53
we can't divide by zero, that means we're here
00:44:55
let's just write a check
00:44:57
if b is equal to zero then
00:44:59
accordingly we will simply
00:45:01
returning the value 0 for example is simple
00:45:03
the number 0 to otherwise we will return
00:45:06
dividing the number 1b
00:45:07
accordingly this is a very important point
00:45:09
because if we don't
00:45:11
a similar check then the program if we
00:45:13
enter the number 0 as parameter b then
00:45:17
the program will exit with an error
00:45:20
accordingly, if we have it
00:45:21
a real program for example, then this would be
00:45:23
the program has closed altogether, it’s very
00:45:25
bad so it must be checked
00:45:27
now what do I want to do for example I
00:45:29
I'll create a new variable, I'm sorry
00:45:31
there will be a fleet, of course, because we have
00:45:33
there is a fleet of data types everywhere here it will be
00:45:36
called rice and she will take
00:45:38
the value of the function that is, we are in it
00:45:41
put the function value for example 23
00:45:43
divided by 2 it will be like this in essence
00:45:45
it turns out that you
00:45:47
when we create a stage
00:45:49
we call the function immediately and do not pass it
00:45:51
we barely check two parameters this 23
00:45:54
if our two is not equal to zero
00:45:56
well, that is, if it is equal to zero then we
00:45:59
return 0 if it is not zero
00:46:00
then we actually end up with 23
00:46:03
divided by 2 will be this result
00:46:05
written into a variable now that I
00:46:07
I can do I can use and
00:46:09
yet with our printf function it is much
00:46:11
I think it’s more convenient than writing
00:46:13
seal online and so on and just for me
00:46:16
write the cut and everything and basically after
00:46:19
we'll have it out now, but it's there
00:46:22
one small mistake what does it have to do with it
00:46:23
is that we
00:46:25
since we have a fleet and we have to come here
00:46:28
pass the string parameter that is
00:46:30
again an important point to
00:46:32
Of course I can fix this error
00:46:35
First of all, write down a new function then
00:46:37
there is for example
00:46:38
copy this function write print
00:46:40
the fruit is to transfer float values ​​here
00:46:43
accordingly, and then use
00:46:45
specifically the function print fleet where is it there
00:46:49
we had it here it brought
00:46:50
Well, yes, of course there will be no mistakes, but
00:46:53
it's inconvenient it's really inconvenient
00:46:56
how can we solve all this?
00:46:58
in C plus plus language there is such a thing as
00:47:00
function overloading what does it mean
00:47:03
means that we take this function of ours
00:47:05
white print and overload it then
00:47:09
yes, we are already passing parameters here
00:47:11
another for example not string but for example
00:47:13
fleet that is us the same name
00:47:14
all absolutely tori the newest parameter
00:47:16
we are already transferring to another or for example we
00:47:18
we we could transmit something else
00:47:20
the number of these parameters is thus
00:47:22
here again to return that we are
00:47:24
use the function in this way
00:47:26
thanks to this before overloading methods
00:47:29
We the compiler understands which one exactly
00:47:31
functions we refer to example here we
00:47:33
let's turn to this function why
00:47:35
because we are passing a parameter here
00:47:37
string specifically with this data type
00:47:39
string right here he understands that we
00:47:41
we transfer the slot and accordingly it
00:47:43
understands that we are addressing this
00:47:45
functions and thus if that's all
00:47:47
try to display all this on the screen
00:47:49
we can't try to start it
00:47:51
absolutely no errors everything is displayed
00:47:53
absolutely correct eleven s
00:47:55
half and hello world absolutely
00:47:56
are displayed correctly in addition
00:47:58
method overloading can be done again
00:48:00
to be achieved thanks to what we
00:48:03
add several parameters, that is
00:48:05
for example here we had a flat bar
00:48:07
here we had, or rather, string word a
00:48:09
here I will for example convey
00:48:11
several parameters for example, even with those
00:48:13
the same with the same meaning with the same or rather
00:48:16
data types, that is, for example
00:48:17
string word and additionally another example in
00:48:20
the next parameter may be it again
00:48:22
after all, string can be any type
00:48:24
data Let’s just omit it, but for example here
00:48:27
accordingly the board is what I will
00:48:28
write here
00:48:30
example we will display proud and plus a
00:48:33
let there be an additional plus
00:48:35
we have some additional gap here
00:48:36
such, for example, that is, thanks to this
00:48:39
thanks to this poison they can
00:48:40
add some more here
00:48:42
result resort is is ii + second
00:48:47
as a parameter, pass all of ours like this
00:48:49
so again, the compiler will understand
00:48:51
what we specifically address in this
00:48:53
case to this function why because
00:48:55
we will pass two parameters here:
00:48:57
line and this is the result of type fleet here
00:49:00
accordingly we will get something
00:49:03
similar to this here is the result from 11 s
00:49:06
half respectively this way
00:49:08
we can implement overload
00:49:09
methods and in general this is how we
00:49:11
we can write functions in C plus language
00:49:13
plus besides former plus plus
00:49:16
it is considered good form when we
00:49:18
write functions not above main functions
00:49:21
and under it but remember I told you that
00:49:23
You can't do that because the compiler
00:49:25
won't notice them and just be talking
00:49:27
that such courses do not exist means how
00:49:30
this can be implemented
00:49:31
look I'm wearing for example the function howls
00:49:34
print I'll just cut it out and instead
00:49:37
I’ll write her boyfriend and then tell her
00:49:40
one parameter string word for example here
00:49:43
and after that I’ll close it like this
00:49:45
So with a semicolon everything is like this
00:49:47
way the compiler will pass it
00:49:49
will already understand that there is such a thing
00:49:51
function called print it
00:49:53
takes one parameter, this is a string and
00:49:56
board is basically what this thing is called
00:49:58
this parameter and now I can under
00:50:01
main functions implement this function
00:50:03
that is, very here and and just write down and
00:50:05
all this way we all these functions so
00:50:08
the same thing can be remade, that is, simply
00:50:10
by writing them down
00:50:12
in this way, for example, we would have a fleet
00:50:14
would be so the fleet would be
00:50:16
here was in the fleet and basically
00:50:20
we closed it all and here she is
00:50:22
If only this function already existed
00:50:24
same with this function this way
00:50:26
when we open the program we don’t see
00:50:29
these bunch of our different functions we
00:50:30
we immediately see what functions we have
00:50:32
exist and we immediately see the main funk
00:50:36
immediately the most important function of me is this
00:50:39
it's considered good manners
00:50:40
programming is why
00:50:41
do better
00:50:43
record here create visibility
00:50:46
the fact that you exist these functions
00:50:48
and then implement them under the functions
00:50:52
together so you will have everything right
00:50:54
Amazing
00:50:55
let's also look at the exception to
00:50:56
For example, I'll take our to-do function and
00:50:59
I'll basically delete everything here, exit like this
00:51:00
there are already checks and the function will always be there
00:51:02
work correctly but also better
00:51:04
use for similar cases
00:51:05
checks that is trike hdmi three times
00:51:08
anything we try avtech we anything
00:51:09
catch therefore otter I try if ours
00:51:13
b will not be equal to zero
00:51:15
then accordingly let's just
00:51:17
let's return face or let's do this
00:51:20
We won’t even be here to return us
00:51:22
here entries and we will be just a game for him
00:51:26
it will be stronger here we are to this figure
00:51:28
we will assign values ​​for example but
00:51:31
let a divided by b respectively
00:51:34
it will all be logical and true
00:51:37
everything is absolutely fine, but if you
00:51:39
us b will be equal to zero, that is, lc then
00:51:43
we will throw it away
00:51:44
error, that is, the deadline, throw out the error and
00:51:47
we put a parameter in it, for example I
00:51:50
I would put that is ours this one here
00:51:51
the variable is essentially now what I do I
00:51:54
I'll write down the following keyword: bake I
00:51:57
I'm catching this error as if I'm the only one here
00:52:00
this is our parameter that we are passing
00:52:02
in my case, for example, maybe we
00:52:03
let me write barium so that it’s somehow
00:52:05
it sounded different and that's what I'll be here
00:52:07
I will do to our variable p c
00:52:10
let us add the value such that a
00:52:13
well, let's just let ours just
00:52:16
the variable res will be equal to the number a
00:52:17
that's all we are here anymore
00:52:19
besides I am registered incorrectly
00:52:21
wrote the oven therefore
00:52:23
I'm sorry for this, it's better like this
00:52:26
the way it is written, correct it if
00:52:28
they also spelled it wrong
00:52:30
the last thing I need to do is
00:52:32
because he is thus our function
00:52:34
completely ready completely done then
00:52:37
here we will try to do something
00:52:39
if we get that definition well
00:52:42
so that the ball is not equal to zero, we all
00:52:44
divide correctly if it is equal to zero then we
00:52:46
we throw an error and in this error we
00:52:48
we just do the next thing like this
00:52:50
like crucian carp we assign a value otherwise
00:52:53
there is this way you can track
00:52:54
exception errors here in principle
00:52:57
anyway, let's do it now
00:53:00
consider pointers and links to the first
00:53:02
at a glance it will seem to you that the pointers and
00:53:04
links are basically the same thing
00:53:05
in fact these are slightly different things
00:53:07
then I will explain what it is in principle
00:53:09
and what are their differences, now let us
00:53:11
just by you we will create a flour pointer
00:53:14
that is, using the example, I will create a new change
00:53:15
she will be well i her value will be 9
00:53:17
for example, now I will create another one
00:53:19
the variable will already be a pointer to
00:53:21
I write our first variable using the example
00:53:24
I’ll write my way and then I’ll insert an asterisk
00:53:26
Becker, for example, is just a name
00:53:28
our peterbilt variable is ours
00:53:31
name of the variable here and I indicate that
00:53:34
This
00:53:35
this pointer it refers to
00:53:37
variable b for this I put
00:53:39
ampersand and indicate values ​​and indicate
00:53:43
the name of the change for which I
00:53:44
I refer in such a way that I need it
00:53:47
in principle, everything is given by the fact that when
00:53:49
in a case like this we just get it
00:53:52
drink and r.l. copy the value of our
00:53:55
variable b, let's do it in principle
00:53:58
I didn’t want to bring it out so that by the way
00:54:01
output must also be used
00:54:03
peterbilt asterisk we then for example
00:54:05
I’ll add more online
00:54:06
Now let's run this all and we will notice that
00:54:09
we have 5 are well she really is
00:54:11
as you can see it was not originally
00:54:12
assigned and but actually output
00:54:14
values ​​9 for her, that is, I just
00:54:16
you copied the value of the variable
00:54:18
ask why such nonsense is needed at all
00:54:20
to do is that it's here it's very
00:54:21
important point in c plus plus
00:54:23
and an incredibly useful point in si plus
00:54:24
plus remember we are just with you
00:54:26
we looked at the functions and functions
00:54:28
passed various parameters and ok to
00:54:30
in this case we had simple ones there
00:54:32
parameters and by number 1.
00:54:34
is it a small line or something like that
00:54:36
spirit, but if we need a function
00:54:38
pass a huge array for example this
00:54:40
it's very stupid to take it and completely
00:54:42
transfer you for example take for example
00:54:44
will say
00:54:45
led it just let us be
00:54:46
a huge array and for example we
00:54:48
take it and grind it completely
00:54:50
functions it would be stupid it would be much
00:54:52
more convenient much smarter to transfer
00:54:55
specifically a copy of this array for example
00:54:58
for this we can make something like this
00:54:59
copies, that is, we take and make a copy
00:55:01
but in our case we made a copy
00:55:02
variable, well, basically the same
00:55:05
things happen with arrays of others
00:55:07
data types and then something here is simple
00:55:09
this example was here and then we already
00:55:12
we pass exactly the copy to the example function
00:55:14
if only we had some kind of funk oops
00:55:16
funk example here and there you conveyed
00:55:18
here is the parameter Peter white-white for example
00:55:22
and accordingly it would already be
00:55:23
a copy of our array, for example, or in
00:55:26
in our case, this is a copy of our variable
00:55:28
and this greatly optimizes our
00:55:29
program and believe me when you will
00:55:32
creating a huge program is very
00:55:33
will help you a lot for optimization except
00:55:36
what else can be done can be done
00:55:38
pointer to pointer how it
00:55:40
it's done it's done with the help of already 2
00:55:43
just asterisks can also be a pointer
00:55:45
to pointer to pointer do at
00:55:47
help three for the protective ones so on
00:55:49
how I usually write it down
00:55:52
St. Petersburg is further than lvl 5, that is, like this
00:55:55
Peter is always added
00:55:56
additional axis + 1 if plus one
00:55:58
asterisk + 1 peter but it's like so
00:56:01
purely ethics you can say that's what I
00:56:04
here did I already make a pointer to
00:56:05
the pointer is accordingly simple
00:56:07
insert person.it lvl like this
00:56:09
way now if I output here
00:56:11
I also picked this thing up here
00:56:13
two stars needed
00:56:14
put it in principle that's all
00:56:16
will update and we will see what we have
00:56:17
and yet 9 came out all which we have
00:56:19
there’s just a copy of Inkin’s copy
00:56:21
the original so to speak except that
00:56:24
there's more you can do, look
00:56:26
why do I say that you really are everything
00:56:28
before we copy because for example if
00:56:31
take the index of the cell in which it is located
00:56:34
information for example, related to this pointer
00:56:37
we can simply take this index
00:56:39
by writing picker
00:56:40
for example Peterbald here is an additional one
00:56:43
I’ll also display the index of where it is located
00:56:46
our variable in
00:56:48
for this I will need to put
00:56:50
ampersand then we will notice that these two
00:56:53
the cells will not be identical, that is
00:56:55
look if you look closely here
00:56:57
the only thing is no, I'm sorry they won't
00:56:59
identical and because I didn't take petir
00:57:02
Petyr Vala and it’s still a copy of us
00:57:05
for a copy that's why let's do it anyway
00:57:07
let's do Peter Val and Peter and just in
00:57:10
if you take these, then they are
00:57:12
really will be absolutely similar
00:57:13
they are identical and there will be cells like this we
00:57:16
actually making a copy
00:57:17
let us now consider a certain variable
00:57:19
links and again I repeat they are very
00:57:21
similar to and pointers, that is, you are right
00:57:23
now you won't feel any difference
00:57:25
first, let me probably delete this
00:57:27
we will also remove this thing Peter Waves in
00:57:29
in principle we will have exactly the link
00:57:31
so how did I write down
00:57:32
I put an ampersand next to something
00:57:34
the name I will put for example that the tariff
00:57:36
that is, the referent is here, for example, a link and
00:57:38
here I no longer need to point from the pier
00:57:40
Well, that is, how to refer to a cell
00:57:42
and refer to Yandex, namely just us
00:57:44
we make a reference to a variable, that is, we
00:57:46
we don’t copy it and just build on it
00:57:48
link what happens here when we
00:57:50
then we will refer to this link we
00:57:52
we won't be able to have direct access
00:57:55
directly to we as if not not directly
00:57:58
we work with this variable and we
00:58:00
just refer to this variable then
00:58:02
is if we copy if with pointers
00:58:05
we copy everything, then with links we just
00:58:07
we refer exactly this way and
00:58:10
what can be done here in principle if
00:58:12
I'll display it on the screen for example
00:58:14
they simply omit the Russian Federation, for example
00:58:18
we will notice the next topic that us
00:58:21
the same number will be displayed on the screen again
00:58:23
9 that is, everything is absolutely logical, but the point is
00:58:26
what is it that we are not a reference
00:58:28
copied
00:58:29
we just took the data and and
00:58:33
made a reference to a variable we need
00:58:35
where and when is it better to use a pointer
00:58:38
When is the best time to use links?
00:58:40
if you work with any
00:58:41
dynamic arrays for example
00:58:43
heels in which will be added there
00:58:45
new elements in the future and so on
00:58:46
then it is better to use pointers to
00:58:48
for example, in our case we are in this
00:58:50
right now we're just
00:58:51
working with one simple change
00:58:54
so it would be more appropriate here
00:58:55
use exactly the link that's what we
00:58:57
just what they did to you, that is, we are here
00:58:58
I used the link with you here in principle
00:59:01
these links they and links index they
00:59:03
perform their role perfectly when used
00:59:06
their functions, that is, how to use them
00:59:08
functions are very simple just you instead
00:59:10
in order to pass the variable itself
00:59:12
pass on and either a link to this
00:59:14
variable or pointer to this
00:59:16
change this program will already be much
00:59:18
it will work much better
00:59:20
optimized rather than
00:59:22
I'd rather not do that now
00:59:25
let's get down to a topic like
00:59:27
creating classes and objects
00:59:29
what is experience in principle when we
00:59:31
we create a certain class and from this class we
00:59:34
create an object and for example we will be
00:59:36
class machine and we can create
00:59:38
several objects for example it will be
00:59:39
let skoda
00:59:40
and a Skoda car, an Audi car and a BMW car
00:59:43
that is, each car will have
00:59:45
own characteristics but
00:59:47
Moreover, if we are in class anything
00:59:49
write to write new function to
00:59:51
for example, to make the car move
00:59:52
then all objects will turn out this time
00:59:54
function and we can no longer do it
00:59:56
rewrite for each object
00:59:57
separately, that is, it is very convenient and
00:59:59
let's do it better with an example
01:00:01
let's consider first we will get out of
01:00:03
functions main and write just the class
01:00:05
keyword and for example and I’ll name it
01:00:07
like corr because I want to create a class
01:00:10
with cars it’s important that you do more
01:00:12
also closed
01:00:13
further with a semicolon, that is, this is it
01:00:15
such an important moment
01:00:16
further in the class we can create with
01:00:19
you function fields or rather in the class it is
01:00:22
It's not called a function, but it's essentially a method
01:00:24
these are the same fields, these are variables
01:00:26
that is, we can create with you
01:00:28
essentially fields and methods are also constructor and
01:00:31
destructor and let's start
01:00:33
Let's create a certain field with you and for example
01:00:36
we indicate that access will be controlled for him
01:00:39
that is, all the fields, all the methods that
01:00:41
are with access to the authorities and they
01:00:44
belong exclusively to the class and are not
01:00:46
visible outside the classroom and in other classrooms and their
01:00:49
also not a view, for example, if here
01:00:50
in height I’ll indicate for example oops height then
01:00:54
we get variable access which we
01:00:56
we have exclusively in this class then
01:00:58
Is there an example if I continue to write?
01:01:00
there is some function I can specify that
01:01:02
I am the height in it
01:01:03
using this function but the main thing is
01:01:06
that outside of this class I do not have access to
01:01:09
this variable I to this field and and
01:01:12
In general, outside of classes I also have access to it
01:01:14
to them this is precisely an access modifier
01:01:16
right there is also a protector
01:01:19
protected is when we will be when we have
01:01:22
again let there be some change
01:01:24
this will already let in agility, for example, and
01:01:26
it will be I don't know speed
01:01:29
let this be what it means here too
01:01:32
what we have access to in the classroom is of course
01:01:35
in which we created this change and
01:01:37
also you are the heir classes
01:01:39
will inherit from this class them we
01:01:40
We'll look at both access and
01:01:43
public access modifier
01:01:44
tells us that all variables are all
01:01:48
functions that will be written in it we
01:01:50
we can contact them from the classroom itself
01:01:53
classes of heirs and generally from others
01:01:56
in general there well and in general if we for example
01:01:58
in the main function we will then create an object a
01:02:00
we will again have access to everyone
01:02:03
with this one things that are in public
01:02:05
access modifiers are now in
01:02:07
public modifier let me create
01:02:08
new new method
01:02:10
I'll call it z plus, that is, thanks to
01:02:13
In this method we will install two
01:02:14
these are our variables, for example them
01:02:16
we will install
01:02:17
besides I don't use what on
01:02:19
trace inheritance therefore not but protected
01:02:21
I’ll just delete this modifier now
01:02:22
I will be in we are in
01:02:24
modifier rules here these
01:02:26
variables besides all these
01:02:28
modifiers can also be used public
01:02:30
you can write your variables to
01:02:31
for example, if there is some variable at home
01:02:33
write down can also be corrected
01:02:35
write down some methods like I do now
01:02:36
in a public post, that is, it’s just like
01:02:39
example now that I'm here not that I'll be
01:02:41
pass to this to this method in this
01:02:43
method I pass 2 in two parameters this
01:02:47
hate that is the height of which I will be
01:02:49
I set it to install for a specific machine
01:02:51
fleet is speed, that is, again for
01:02:54
specific car now that I
01:02:56
I will do when I call the functions I want
01:02:58
set these parameters for these
01:03:01
for these fields which are in
01:03:03
class how do I write the key
01:03:05
I put our word here like this
01:03:07
things, that is, I indicate that I
01:03:09
I turn to this class and take it from him
01:03:11
for example height of this variable
01:03:14
and set the parameter values ​​for it
01:03:16
which we are just passing on here, that is
01:03:17
this is the same parameter
01:03:19
absolutely I do it for speed
01:03:21
that is, for speed like this
01:03:24
now we are preparing to call the function
01:03:25
set two two new parameters with
01:03:29
to the objects that I create now
01:03:31
let's just create some new one
01:03:33
object how to make it exactly the same here
01:03:35
as we wrote for example intel and float or
01:03:37
so then here it’s the same thing only
01:03:39
you need to write the name of the class for which
01:03:41
we from which we want to make an object
01:03:44
that is, I am writing in my case corr because
01:03:46
that it is called that and for example
01:03:48
I will have a Skoda car
01:03:49
now let's just close it all and
01:03:51
basically now I can refer to this
01:03:53
skoda as to an ordinary object, that is, as
01:03:55
as some kind of variable and through a dot
01:03:59
get all those fields and all those methods
01:04:02
who are in public because
01:04:04
will fix and protect these they have access to
01:04:06
to them so what can I do here
01:04:07
see here by the way
01:04:08
in young fleet and float speed or rather
01:04:12
I'm sorry they crossed out because they are located
01:04:14
correct accordingly I have no relation to them
01:04:16
access, for example, if it’s purely for
01:04:18
example if I translate it will be corrected to
01:04:21
public then again.
01:04:23
even though he is sleeping, we can already have access to them
01:04:25
access is important here's the moment back
01:04:27
We’ll probably return all this, that’s what it means again
01:04:30
once skoda and I want to take the sequel from here
01:04:32
this this is our method and transfer to
01:04:34
2 parameters for example we will have a car
01:04:37
weighs one thousand one hundred kilograms, that's the speed
01:04:41
and let it be with me, she misses 234.
01:04:45
44 that's what they are and the speed
01:04:48
it will be a super fast skoda in principle
01:04:50
Now I have these parameters set
01:04:51
let us also have them all
01:04:53
additionally output therefore I will
01:04:55
I’ll write another method here: print
01:04:57
launch will be called and for example everything
01:04:59
what will he do he will be on the screen
01:05:02
In principle, we can display the height here
01:05:06
again use zys ys ys ys
01:05:10
let him be here at the height
01:05:14
output and also through some other under
01:05:17
This is what a physicist will deduce
01:05:19
additionally letting in here. they are not .
01:05:23
speed here we are, in principle, online
01:05:26
be and in general that's all now I'm again
01:05:28
I can still use this method, I write
01:05:31
just skoda. print and that's it and output to
01:05:34
screen this is this line
01:05:36
and with the values ​​that I
01:05:38
installed here one thousand one hundred and two hundred
01:05:40
three four let's start it all up what
01:05:42
see what 2 turned out to be
01:05:44
we'll get just a simple little thing
01:05:46
we will be displayed on the screen one thousand one hundred and two hundred
01:05:48
344, that is, which was originally installed
01:05:50
but what is the special edge in that
01:05:52
what if I create a new car
01:05:54
this new object will be audi for example and
01:05:56
for it I will set new values ​​to
01:05:59
example here I will release 2
01:06:01
tons and the speed there will be 300 25.5
01:06:06
let us notice what we have for the new
01:06:09
machines are set to new values
01:06:11
this is very very cool because
01:06:13
now we have a class in which there is
01:06:16
general some values ​​general fields general
01:06:19
methods
01:06:20
so we can based only
01:06:21
create objects that will have
01:06:24
own characteristics but in principle
01:06:25
if we want to add to all objects
01:06:27
a new function to make the car drive for example
01:06:30
you just class this function
01:06:31
we add and all our objects are already
01:06:33
All of our machines are already capable of
01:06:35
yoga ride is very, very cool
01:06:37
now let's talk about constructors
01:06:39
designers are basically such a thing
01:06:41
here it is and now we have it but it
01:06:43
using the default here i.e.
01:06:45
when we create an object
01:06:46
we can immediately ask him some
01:06:48
parameters for example here I am in
01:06:50
the next method already asked him
01:06:52
parameters that is a thousand wait so on
01:06:54
I can do this immediately upon creation
01:06:56
object it would be much more convenient
01:06:57
so again I need constructors
01:07:00
write it down in public because I’m
01:07:02
I want it immediately when creating objects and not
01:07:04
set parameters so I and so and
01:07:05
I did it, I'll write it down, it will be a public constructor
01:07:08
how does it fit in exactly
01:07:10
should rewrite the name of our class
01:07:11
further as if this function or so
01:07:14
as if this method is working itself out
01:07:16
in principle and in the same in the same throwing
01:07:19
which constructor actually is
01:07:20
write down anything basically
01:07:22
for example I will do the following I will
01:07:25
get again release two
01:07:26
parameter
01:07:27
I may not get them kids actually
01:07:29
let me install the kit
01:07:30
receive
01:07:31
In principle, I will install it right away
01:07:33
there is it will be Kai for the Swede only
01:07:34
which will trigger initially at the very
01:07:37
I myself can say the start is like this
01:07:39
look at us here right away
01:07:41
two errors are given because we have
01:07:43
skoda for example and we have no parameters
01:07:45
we don't really need to install here
01:07:47
they need to be installed here, that is
01:07:49
how do I write for example here
01:07:51
let me rewrite the same values
01:07:52
I’ll just comment on it all like this
01:07:55
but for Audi, for example, I don’t want
01:07:57
I want to use a constructor for it
01:07:59
by default how can I do this
01:08:00
do remember we discussed in
01:08:03
redefining the function here is the principle
01:08:05
nothing like this as soon as
01:08:06
overriding constructors i.e. I
01:08:08
I can write down the following that I have
01:08:10
some constructor that does not accept
01:08:13
no meanings and nothing
01:08:15
install that is, like this
01:08:17
The default constructor is like this
01:08:19
So now I will compiler myself
01:08:21
understand when I use the constructor
01:08:23
for example for skoda I use
01:08:24
the designer here is this one, that is, prestor
01:08:27
when creating an object, I immediately give it
01:08:28
parameters and for audi I use
01:08:30
the designer is this one when I do nothing
01:08:32
I don’t pass it on and then I can, for example
01:08:35
or
01:08:36
purely at will, I can already add some
01:08:39
new characteristics for a car or
01:08:42
do not do this, in addition, look here
01:08:44
skoda I can and will comment on this one too
01:08:46
I can also immediately call a line of code
01:08:49
for example our print function
01:08:51
So I just write print and that’s it
01:08:53
way now when creating an object
01:08:54
skoda I immediately set the parameters and
01:08:56
immediately and display these parameters if it is
01:08:58
I’ll display everything on the screen and then we’ll replace it
01:09:00
basically the same as before
01:09:02
it was but nevertheless it is already with
01:09:03
using constructor names that
01:09:06
much more convenient actually besides
01:09:08
there are also destructors destructors
01:09:11
they are written as follows
01:09:13
there it is written like this tilde
01:09:15
then the name of the class is written and
01:09:19
this destructor is triggered when we
01:09:22
it turns out we finish working with the class then
01:09:24
there is, when deleting, you can say class
01:09:26
so here I am all is ok for example I
01:09:31
I'll write
01:09:32
oysters ok here and for example online
01:09:35
I'll add it when you get it, let's do it
01:09:38
let's run it all again and see
01:09:40
when you see this one with us
01:09:42
the destructor starts up as you can see it after
01:09:44
just after we created one
01:09:46
object after we created the second one
01:09:48
object and then only you were taken out
01:09:50
twice the music, that is, it is displayed
01:09:52
after we've finished
01:09:54
work with the class we have completed work with
01:09:56
class after creating this second one
01:09:58
of our object when we have all these functions
01:10:00
all these methods have been done more and more by us
01:10:03
they did not return to him later
01:10:05
that's why he's a jockey in the world that's why he's a destructor
01:10:08
worked and displayed paul is ok
01:10:10
destructor I will repeat them again
01:10:13
trigger when finishing work with and
01:10:15
class, that is, they are constructors
01:10:17
vice versa when we just create a class
01:10:19
destructors when we're done
01:10:21
work with the class and let's do some more
01:10:22
Let's look at inheritance
01:10:24
inheritance is a very important concept about
01:10:26
so it's still worth considering
01:10:28
example here we have a class to
01:10:29
we can create another class which
01:10:31
will inherit all all fields all
01:10:34
methods from our main class to
01:10:36
For example, our main class will be
01:10:38
corr and he will explore all these fields
01:10:41
and methods that are modifier
01:10:42
public access
01:10:43
or protect extra view I again
01:10:45
I repeat, these are only those
01:10:47
this is all they are doing
01:10:50
are coming exclusively for this class itself then
01:10:52
there are more and more of them nowhere to be seen so
01:10:54
let me create a new class for example
01:10:56
it will be nothing again
01:10:58
nothing new is happening yet, we are writing
01:11:00
class moto mod say if not correct
01:11:04
I wrote that, sorry
01:11:05
here is a motorcycle and it is inherited from the class
01:11:09
I won’t leave it this way: later
01:11:12
food by black car
01:11:14
well, that is, class pen, I want everything
01:11:16
inherit and basically it’s the same
01:11:18
I already have the schema in this class now
01:11:21
access to example destruct constructor
01:11:25
corr to the method Silva carried away print and in
01:11:29
principle to the destructor even have also
01:11:30
I don’t have any toast here yet
01:11:33
no access see what I can do
01:11:35
do for example if and now I create
01:11:37
let's say, for example, the sea will cycle me and
01:11:41
let it be me
01:11:44
mw they are produced like this and if I
01:11:48
I want a BMW now
01:11:50
use set given here, that is, like
01:11:52
you see I really mean them
01:11:54
access and it's very cool that is me
01:11:56
it turns out this class inherited all those
01:11:58
fields all those methods from our main
01:12:01
class our main class is like this
01:12:04
So I can basically point this out here
01:12:06
23
01:12:07
indicate here 234 4 for example and in
01:12:10
basically if in the future I will
01:12:13
use give something else
01:12:14
redistribution I will put here that we are we
01:12:16
we use protected, that is, it
01:12:19
is now available directly from
01:12:21
not only this class but also
01:12:23
additionally from moto sites now
01:12:25
in the future if I want to withdraw here I am
01:12:28
I installed them, these don’t matter now
01:12:30
I want to get these two out of motorcycles
01:12:31
I will add additional values ​​here
01:12:34
new method
01:12:35
he will be on my public page evil oops
01:12:37
change the public and then void
01:12:40
well, let it also be called
01:12:42
for example, since they do not conflict with these
01:12:45
two names 2 absolute classes no
01:12:47
there will be no conflicts here now
01:12:49
just to show off hate or
01:12:51
and Petya using the following I can
01:12:52
write basically the same thing
01:12:54
the most important thing was that it was here and
01:12:57
just put it here
01:12:58
the only thing I don't need
01:13:00
use zys because it’s a principle
01:13:02
you can just use what I
01:13:05
I use faith I take the hater she sleeps
01:13:07
which is in my class
01:13:08
basically it's hi-speed
01:13:11
I just miraculously get them out this way
01:13:13
look I created a descendant class from
01:13:15
BMW object BMW
01:13:17
indicated the values ​​for it and through
01:13:20
method which is in the main class
01:13:22
here and now I can use
01:13:24
own method
01:13:25
I opened the class BMW motorcycle and put it
01:13:29
here I write print for example now
01:13:32
if I run this all then we will notice
01:13:35
The following is what we get:
01:13:38
here is our first value is 200 323 and
01:13:42
230 4.4 that is, absolutely everything is correct
01:13:44
it works and it's just great
01:13:46
so, in principle, you and I can
01:13:49
say we have completed work on
01:13:50
classes and objects
01:13:52
We looked at how classes are created
01:13:54
how objects are created that's all
01:13:56
objects this is how field methods are created
01:13:59
access and inheritance modifier at once
01:14:02
also my constructor and destructor and and in
01:14:03
In principle, we can end this
01:14:05
and this is where we can end our
01:14:08
The video lesson turned out to be very big but
01:14:10
in it we sorted out absolutely all those
01:14:12
important concepts that are present in
01:14:14
and siii++ now you can
01:14:15
really say that you know
01:14:17
plus plus of course you need a little
01:14:19
practice but nevertheless we are all basic
01:14:21
moments you already know in C plus plus
01:14:24
That's all, sign up and go to
01:14:26
VKontakte group go to the IT website
01:14:27
Prager dot com all links will be in
01:14:29
video description see you soon

Description:

В этом видео мы с вами изучим C++ от самых азов и до сложных задач всего лишь за час! В уроке мы изучим переменные, циклы, условные операторы, а также затронем сложные темы, к примеру: классы, объекты и многое другое. 1) Скачать Visual Studio: https://www.visualstudio.com/ru/vs/cplusplus/ 2) Онлайн компилятор: http://cpp.sh/ 3) Урок на сайте itProger: https://itproger.com/course/one-lesson/5 4) Полный видеокурс по языку C++: https://www.youtube.com/playlist?list=PL0lO_mIqDDFXNfqIL9PHQM7Wg_kOtDZsW ✔ Основной сайт: https://itproger.com/ ✔ ------------- Группа Вк - https://vk.com/prog_life Группа FaceBook - https://goo.gl/XW0aaP Instagram: https://www.instagram.com/gosha_dudar/ Я в Google+ - https://goo.gl/Tqt9W0 Страничка Twitter - https://twitter.com/GoshaDudar Страничка Вк - https://vk.com/codi999 ✔ Начните зарабатывать на YouTube - http://join.air.io/money_air ✔ Видео по заработку на YouTube - https://goo.gl/RLPXV8 Помощь в развитии канала. * Яндекс Деньги: 410014343706921 * Кошельки WebMoney: - Доллар: Z331064341236 - Гривна: U386388718252 - Рубль: R214610220703

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Изучение C++ в одном видео уроке за час!" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Изучение C++ в одном видео уроке за час!" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Изучение C++ в одном видео уроке за час!" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Изучение C++ в одном видео уроке за час!" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Изучение C++ в одном видео уроке за час!"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Изучение C++ в одном видео уроке за час!"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.