Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,900 --> 00:00:08,220
So one of the questions that may arise after working with the previous relational operators is what
2
00:00:08,220 --> 00:00:12,930
will happen if we will try to use some mathematical operations on structs.
3
00:00:13,530 --> 00:00:18,960
So we know that if we create some variable, some standard variable income equals two five, we can
4
00:00:18,960 --> 00:00:20,340
write down nonplused plus.
5
00:00:21,240 --> 00:00:24,450
And that's it, it will simply increment the value of number one.
6
00:00:24,810 --> 00:00:29,940
And we can also ride down nonplused equals to three, it will increment the value of number three.
7
00:00:30,300 --> 00:00:33,390
OK, so we can do that for an indigenous floats and so on.
8
00:00:34,830 --> 00:00:36,450
But the question is what will happen?
9
00:00:36,450 --> 00:00:37,950
Let's comment it out simpler.
10
00:00:38,310 --> 00:00:42,750
But the question is what will happen if we will use it on structs?
11
00:00:42,870 --> 00:00:43,260
OK?
12
00:00:43,320 --> 00:00:50,430
Will you use some operations like we've specified previously, like nonplused plus, if we use it on
13
00:00:50,430 --> 00:00:57,960
point, which is a variable of a point type so we can write down point plus plus point b point one,
14
00:00:57,960 --> 00:01:00,330
which is a variable of a point structure.
15
00:01:00,630 --> 00:01:07,860
We can write down point one plus plus, but now at this point, it should be crystal clear to you that
16
00:01:08,130 --> 00:01:11,430
this thing is not supposed to work.
17
00:01:12,390 --> 00:01:16,770
And the reason is very simple, because we write down plus plus, but what do we mean?
18
00:01:17,220 --> 00:01:21,910
Do we actually want to take each of these fields in incremented by one?
19
00:01:22,830 --> 00:01:26,490
Or maybe we want to take just the field into incremented by one?
20
00:01:27,240 --> 00:01:31,230
And what will happen if we have a structure called employee?
21
00:01:31,470 --> 00:01:35,910
And the first field is basically the name of the employee, then what will it mean?
22
00:01:35,910 --> 00:01:37,500
Like Employee Plus Plus?
23
00:01:38,650 --> 00:01:44,650
What will it mean, what field should win criminally, how we should increment basically a field that
24
00:01:44,650 --> 00:01:50,080
is war, basically that is considered to be of a type like a string?
25
00:01:50,470 --> 00:01:54,610
OK, so that's very important to explicitly specify what we want to do.
26
00:01:55,150 --> 00:02:02,440
We cannot write down point B. one point one equals two point two plus three because what is the result
27
00:02:02,440 --> 00:02:07,990
of these evaluation of these terminology?
28
00:02:08,530 --> 00:02:09,040
OK.
29
00:02:10,050 --> 00:02:17,490
So for that, there is also some option that you should at least know for this point, that's just the
30
00:02:17,490 --> 00:02:24,180
basic option that we can use, and it's called to create fonctions kind of associated with these operations.
31
00:02:24,420 --> 00:02:28,910
I know it's not the most elegant way, but it works for now.
32
00:02:28,920 --> 00:02:30,240
It works just fine for you.
33
00:02:30,630 --> 00:02:33,970
So, for example, you want to make an addition between two points.
34
00:02:34,530 --> 00:02:35,970
You want to see point.
35
00:02:36,370 --> 00:02:41,250
Well, let's say point three equals two point one plus point two.
36
00:02:41,850 --> 00:02:48,660
So the way you can do it is simply by using the addition function that you created, and this addition
37
00:02:48,660 --> 00:02:53,190
function will receive point B one and point B to both of them.
38
00:02:53,190 --> 00:03:01,110
You want to you add together to create the point result and then you simply go over field by field or
39
00:03:01,110 --> 00:03:04,080
basically by the fields that you are interested in.
40
00:03:04,380 --> 00:03:06,480
Maybe other fields simply copy them.
41
00:03:06,840 --> 00:03:07,200
OK.
42
00:03:07,230 --> 00:03:11,170
If the are not part of this addition, I'm just using basic addition.
43
00:03:11,610 --> 00:03:15,600
And finally, once you create these point result, you return it.
44
00:03:17,110 --> 00:03:18,940
OK, so that's one way to solve it.
45
00:03:19,840 --> 00:03:25,120
Another option, basically another function will be to use the increment associated.
46
00:03:25,570 --> 00:03:31,210
This was associated with the operation of, let's say, additions, right?
47
00:03:31,210 --> 00:03:36,880
Instead of additions, we can use the addition function instead of these operator, or we can use addition
48
00:03:36,880 --> 00:03:43,510
function between two points to get the added result.
49
00:03:43,890 --> 00:03:49,090
Again, we can also use it for kind of simulating the increment operator.
50
00:03:49,840 --> 00:03:58,690
So we will send the actual address of a certain point and we will be able to access these fields and
51
00:03:58,690 --> 00:04:03,430
to add them by one, to increment them by one, both X and Y.
52
00:04:04,000 --> 00:04:12,280
And if these structure have additional fields, then we would have to decide what fields should be implemented
53
00:04:12,280 --> 00:04:13,000
and what not.
54
00:04:13,540 --> 00:04:15,580
That's why this thing does not work.
55
00:04:15,940 --> 00:04:23,290
But if we will call these functions from here, like increment here, we can use it increment increment
56
00:04:23,290 --> 00:04:27,190
and send what send the address of point B one.
57
00:04:27,910 --> 00:04:28,540
Then this.
58
00:04:29,560 --> 00:04:30,580
Should do the work.
59
00:04:31,300 --> 00:04:37,930
We will get these peace a point to point you to will point to these point one, and then we will simply
60
00:04:37,930 --> 00:04:41,590
increment the values by one of these actual point one.
61
00:04:41,800 --> 00:04:47,590
So after this line, what we will have is basically point one with the values of two and three.
62
00:04:48,790 --> 00:04:49,270
OK.
63
00:04:49,600 --> 00:04:56,320
And if we wanted to create some new value point three, OK, let's say something like that point.
64
00:04:56,680 --> 00:04:57,830
Point three.
65
00:04:58,300 --> 00:05:01,540
And let's say it should be equal to point one loss.
66
00:05:02,500 --> 00:05:09,880
Point to OK, instead of writing it this way, could his addition of points and then specify point one
67
00:05:09,880 --> 00:05:10,660
and point to.
68
00:05:11,920 --> 00:05:13,330
And that should be.
69
00:05:15,430 --> 00:05:15,790
Good.
70
00:05:16,180 --> 00:05:16,660
OK.
71
00:05:17,230 --> 00:05:18,340
So I hope that's clear.
72
00:05:18,760 --> 00:05:23,890
Let's also just copy it and save it so that we will have these codes right here.
73
00:05:24,550 --> 00:05:25,210
Come on, come on.
74
00:05:25,210 --> 00:05:25,510
Come on.
75
00:05:25,540 --> 00:05:27,670
That's what we had and.
76
00:05:29,390 --> 00:05:31,610
That's what we propose.
77
00:05:32,600 --> 00:05:33,140
Awesome.
78
00:05:34,340 --> 00:05:36,440
So, yeah.
79
00:05:37,890 --> 00:05:38,980
So this is it, guys.
80
00:05:39,000 --> 00:05:40,470
Thank you so much for watching.
81
00:05:40,500 --> 00:05:44,280
Let's move on with the material now that you were filling.
82
00:05:44,370 --> 00:05:50,850
Hopefully more confident and more believing in yourself and your skills is program here.
83
00:05:51,360 --> 00:05:51,810
Good luck.
7801
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.