Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,180 --> 00:00:07,710
In this video, we are going to proceed with the operations on two dimensional arrays, so suppose that
2
00:00:07,710 --> 00:00:15,930
you have declared a two dimensional array like this and Matt and two rows, three columns, and instead
3
00:00:15,930 --> 00:00:23,190
of initializing it with some arbitrary values that you've decided, you want to feel this table with
4
00:00:23,190 --> 00:00:25,470
values received from the user.
5
00:00:25,950 --> 00:00:32,040
You simply want to get all the two dimensional array values as inputs from the user.
6
00:00:32,460 --> 00:00:33,860
So how would you do it?
7
00:00:34,020 --> 00:00:41,990
The first step in doing so is understanding the fact that we are going to use our famous SCANA function.
8
00:00:42,270 --> 00:00:43,470
That's the first step.
9
00:00:44,130 --> 00:00:51,810
The next steps are very easy and very similar to the way we did it with one dimensional arrays, with
10
00:00:51,840 --> 00:00:58,420
one dimensional arrays to put an input from the user to a specific element in this array.
11
00:00:58,530 --> 00:01:03,580
We just specified the address of the desired element in this area.
12
00:01:03,630 --> 00:01:04,170
Right.
13
00:01:04,570 --> 00:01:08,160
So the same goes here with the two dimensional arrays.
14
00:01:08,400 --> 00:01:16,470
Basically, since we know that our two dimensional array or as we sometimes refer to it as a grid of
15
00:01:16,470 --> 00:01:23,730
rows and columns, it's just a bunch of sequence, the elements sitting somewhere in the memory.
16
00:01:24,150 --> 00:01:33,000
So to feel a specific element with a value received from the user, we just need to specify the address
17
00:01:33,000 --> 00:01:38,460
of these desired element where we want to store the input.
18
00:01:38,760 --> 00:01:46,890
So if, for example, we want to store it inside of the first element, which is it row zero and column
19
00:01:46,890 --> 00:01:54,300
zero, you just specify the element itself and then you use this kind of function, add the ampersand
20
00:01:54,300 --> 00:01:58,310
and read the value to a given location.
21
00:01:58,500 --> 00:02:00,270
So nothing complicated.
22
00:02:00,270 --> 00:02:08,220
Geisen for example, here we received seven from the user and basically also if we wanted to get all
23
00:02:08,220 --> 00:02:15,840
the elements for a given two dimensional array, then in this case what we have to do is to do some
24
00:02:15,840 --> 00:02:24,690
sort of iteration into iterate over all the rows and all the columns at each row, and very similar
25
00:02:24,690 --> 00:02:28,830
to the example that we've seen how we can print all the values here.
26
00:02:28,830 --> 00:02:36,480
We can read OK from the user, every one of these values by using this kind of function.
27
00:02:37,050 --> 00:02:44,710
And just a quick side note to remind you guys why we're using the percentage D here, OK?
28
00:02:44,820 --> 00:02:48,990
And that's because we defined an array of integers.
29
00:02:48,990 --> 00:02:51,490
But that's definitely should be clear by now.
30
00:02:51,510 --> 00:02:59,790
OK, so the percentage these because we we are using in a an array of integers and if we were using
31
00:02:59,790 --> 00:03:04,020
an array of loads, let's say it will be percentage F and so on.
32
00:03:04,020 --> 00:03:05,070
You got the idea.
33
00:03:05,100 --> 00:03:07,110
I shouldn't remind me so much.
34
00:03:07,110 --> 00:03:13,540
But still for those of you who forgot how it can be used and how it should work.
35
00:03:13,830 --> 00:03:18,510
OK, so you filled your array pretty simple by using this loop.
36
00:03:18,510 --> 00:03:24,120
Iterate over all the elements of the array and you are reading the input from the user.
37
00:03:24,300 --> 00:03:25,600
Pretty awesome.
38
00:03:26,220 --> 00:03:35,640
So we talked about the percentage, the and what else remains for us to do is basically if you just
39
00:03:35,640 --> 00:03:42,480
the second example, if you would have defined an array of doubles, then you simply would have used
40
00:03:42,480 --> 00:03:43,950
this kind of percentage alef.
41
00:03:43,980 --> 00:03:46,530
But that's nothing complicated.
42
00:03:46,860 --> 00:03:51,490
And I think you already know this much at this point.
43
00:03:51,600 --> 00:03:58,410
So what I suggest you guys do right now is to give it a try on your own, stub this video and write
44
00:03:58,410 --> 00:04:06,480
this simple program that gets input from the user and insert these inputs inside of these two dimensional
45
00:04:06,480 --> 00:04:09,120
array that you've just created.
46
00:04:09,840 --> 00:04:16,800
Also, once you are done with that, make some task, then print the values, just like we've done it
47
00:04:16,800 --> 00:04:24,270
in one of our previous exercises and make sure that the input values that you've used correspond to
48
00:04:24,270 --> 00:04:27,890
the values that you can see printed on the screen.
49
00:04:27,900 --> 00:04:33,930
So basically that there is a correlation between the values you've inserted using your keyboard and
50
00:04:33,930 --> 00:04:37,590
the values that you can see printed on the screens.
51
00:04:37,660 --> 00:04:40,710
And yeah, this is it for these video guys.
52
00:04:40,860 --> 00:04:43,860
I don't have anything else to add here.
53
00:04:44,070 --> 00:04:51,930
A quick video where we discussed something very, very simple is just how to read inputs from the user
54
00:04:51,930 --> 00:04:57,490
and store them inside a given element in our two dimensional arrays.
55
00:04:58,170 --> 00:04:59,910
So thank you and a.
56
00:04:59,950 --> 00:05:01,740
I'll see you in the next video.
5991
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.