1
00:00:00,210 --> 00:00:01,110
OK, everybody.

2
00:00:01,470 --> 00:00:08,070
Welcome back to another lecture in this lecture, we are going to be continuing on with the nested looting,

3
00:00:08,070 --> 00:00:16,950
but what we're really going to talk about is 2D arrays and matrices, which we will have to use some

4
00:00:17,250 --> 00:00:19,830
nested loops to be able to deal with these things.

5
00:00:20,700 --> 00:00:22,920
So let's go ahead and get into it.

6
00:00:24,030 --> 00:00:29,910
So I'm just going to go ahead and pretend like nobody knows what a matrix is.

7
00:00:30,660 --> 00:00:34,410
A lot of you might already know what this is for math classes and things like that.

8
00:00:35,460 --> 00:00:44,280
And what we're really talking about, though, is a two dimensional array and that is a grid and a multiplication

9
00:00:44,280 --> 00:00:50,640
table is a good example of that unit as we have a handful of columns and some rows, and then we have

10
00:00:50,640 --> 00:00:56,400
the corresponding correct products in here at the multiplication of these columns and rows.

11
00:00:57,750 --> 00:01:07,560
So this concept of rows and columns and matrices, we are specifically talking only about 2D matrices

12
00:01:07,950 --> 00:01:08,950
in this lecture.

13
00:01:08,970 --> 00:01:16,110
And if you've taken some math classes before the deal with matrices, you might be thinking that, you

14
00:01:16,110 --> 00:01:19,580
know, of course, matrices don't mean that it's two dimensional.

15
00:01:19,590 --> 00:01:27,210
It could be, you know, in dimensions, any type of any number of dimensions, which you also do deal

16
00:01:27,210 --> 00:01:29,700
with those a lot in computer science and programming.

17
00:01:29,700 --> 00:01:31,980
But that's not what we're looking at right now.

18
00:01:31,980 --> 00:01:38,970
So for the sake of this lecture, just imagine only dealing with a two dimensional matrix.

19
00:01:40,110 --> 00:01:43,370
So we need comfortable with this concept of the rows and the columns.

20
00:01:44,310 --> 00:01:49,770
If this is something you're not familiar with, the green bars are considered rows and the red bars

21
00:01:49,770 --> 00:01:51,480
are considered columns.

22
00:01:52,020 --> 00:01:52,500
So.

23
00:01:55,360 --> 00:01:58,480
This is the way that the Matrix looks in array form.

24
00:01:58,870 --> 00:02:07,750
So think about having an array like you've made before, an array of integers or something like that.

25
00:02:07,960 --> 00:02:12,690
So that array what we would do if we were relating it to what we see here.

26
00:02:13,720 --> 00:02:17,500
So we'd look at these grey brackets right here.

27
00:02:17,500 --> 00:02:26,020
So this open gray bracket in this close gray bracket or the actual array right in the outer layer of

28
00:02:26,020 --> 00:02:32,040
the array, the elements or items inside of the array are the rows.

29
00:02:32,050 --> 00:02:34,570
So rather than having an integer.

30
00:02:35,080 --> 00:02:45,190
The first item or at the 0th position in the array is this whole row here between the green square brackets.

31
00:02:45,490 --> 00:02:50,770
So our rows are denoted by the green square brackets.

32
00:02:51,670 --> 00:02:53,890
So this is row zero.

33
00:02:53,890 --> 00:02:58,180
It is the first item in the array at position zero.

34
00:02:58,810 --> 00:03:00,640
This is row one.

35
00:03:01,480 --> 00:03:03,210
It is at position one.

36
00:03:03,220 --> 00:03:05,020
It is the second item in the array.

37
00:03:06,760 --> 00:03:13,750
This is the road to which is the position to it is the third item in the area.

38
00:03:14,620 --> 00:03:18,400
So are items just so happen to be another array?

39
00:03:18,490 --> 00:03:24,700
So our outer layer is, you know, this whole matrix.

40
00:03:25,830 --> 00:03:32,190
It's this array right here in this array has three things in it, but those three things happen to be

41
00:03:32,190 --> 00:03:32,790
arrays.

42
00:03:32,970 --> 00:03:40,950
And so this is where we get into columns, when we're looking at the positions of each one of these

43
00:03:40,950 --> 00:03:42,750
arrays, which are rows.

44
00:03:43,860 --> 00:03:50,310
We are talking about columns being the positions, so we have our colleagues to noted and read here.

45
00:03:52,240 --> 00:04:02,110
So if I refer to the first item in our whole array, so we're talking about the outermost layer, which

46
00:04:02,110 --> 00:04:03,100
is the grey brackets.

47
00:04:03,610 --> 00:04:08,320
If I refer to the first item, I am talking about rose zero, right?

48
00:04:09,830 --> 00:04:20,960
Now, if I am wanting to talk about the first item in row zero, I am referring now to a column, so

49
00:04:21,230 --> 00:04:22,760
it is column one, right?

50
00:04:23,940 --> 00:04:30,180
That is the first, uh, position of this array right here.

51
00:04:31,960 --> 00:04:35,950
So that's where this other dimension comes in, the first dimension is basically Rose.

52
00:04:36,430 --> 00:04:42,730
That is the initial elements that you're looking at when you would index it just like the race you've

53
00:04:42,730 --> 00:04:43,720
done so far.

54
00:04:43,960 --> 00:04:45,900
You only had one index, right?

55
00:04:45,910 --> 00:04:51,850
You use the index operator and you just indexed into one of the positions, let's say, position zero

56
00:04:52,060 --> 00:04:56,140
that would grab you all this, that I'm circling here, but we're not done yet.

57
00:04:56,140 --> 00:05:02,620
If we want to get an actual value, we now need to think about the position inside of this row and that's

58
00:05:02,620 --> 00:05:04,230
where the red values come in.

59
00:05:04,240 --> 00:05:06,280
These are the positions, they are the columns.

60
00:05:08,560 --> 00:05:13,480
So let's take a closer look at what this exact example would look like when we're trying to raise some

61
00:05:13,480 --> 00:05:16,450
code so we would declare an array.

62
00:05:16,480 --> 00:05:19,870
I'm just calling it an array of integers called my array.

63
00:05:20,140 --> 00:05:22,000
And you notice that it has.

64
00:05:23,150 --> 00:05:30,740
Two sizes here, and you might be able to guess that that's because we need to specify the size of the

65
00:05:30,740 --> 00:05:35,240
rows and the size of the columns, the number of rows and the number of columns.

66
00:05:35,570 --> 00:05:37,220
And that's what these two numbers mean.

67
00:05:37,640 --> 00:05:41,720
Normally you would just block this off and you would only have this right.

68
00:05:41,720 --> 00:05:48,380
You'd say Antminer A3 and you'd be like, OK, I just made an array that has three things in it.

69
00:05:49,360 --> 00:05:56,290
At position zero, one and two, respectively, if you add this second dimension here with another one

70
00:05:56,290 --> 00:06:02,290
of these kind of the index operators, but now they're being used to set the size, of course, when

71
00:06:02,290 --> 00:06:03,670
you declare an array.

72
00:06:05,340 --> 00:06:11,120
Then you're specifying the columns as well, you're adding this new dimension and it becomes a matrix.

73
00:06:12,900 --> 00:06:20,460
So you notice that it has three rows, right, so the initial array has three things in it, and then

74
00:06:20,460 --> 00:06:28,260
we say each one of those things in the array also has three things in it one, two three.

75
00:06:29,190 --> 00:06:30,430
So the first layer?

76
00:06:30,510 --> 00:06:30,930
Right?

77
00:06:31,050 --> 00:06:31,970
Three things in it.

78
00:06:32,000 --> 00:06:33,570
That's one to three.

79
00:06:33,870 --> 00:06:41,830
The second layer, each one of these things has one two three or one two three or one two three, respectively.

80
00:06:43,110 --> 00:06:50,880
So that is how we can, you know, take a look at what we've written so far and imagine how it would

81
00:06:50,880 --> 00:06:52,680
be declared it would be something like this.

82
00:06:54,750 --> 00:07:01,170
Now, let's think about how we would access something in this array, will it be this kind of the same

83
00:07:01,170 --> 00:07:03,990
idea is how we declared it.

84
00:07:04,000 --> 00:07:09,900
We still need to refer to the both the row and the column and specifically in this order, of course,

85
00:07:09,900 --> 00:07:14,550
we need to first index into the first layer, which is the rose.

86
00:07:14,820 --> 00:07:23,490
Right after we get the correct row that we want, we can then choose the column from that row, right?

87
00:07:24,270 --> 00:07:25,590
So what would this be?

88
00:07:25,680 --> 00:07:27,590
Well, let's first look at the row, right?

89
00:07:27,600 --> 00:07:29,010
It's row zero.

90
00:07:29,020 --> 00:07:38,290
So that means that it's the zeroth position in this outer array, which gives us this right here, right?

91
00:07:38,370 --> 00:07:42,300
This is the first thing in there is the zeroth position.

92
00:07:43,380 --> 00:07:49,200
Once we have this now we have an array right when we do Myra's zero.

93
00:07:49,290 --> 00:07:52,320
It now gives us this right here.

94
00:07:52,500 --> 00:07:54,390
This happens to be another array.

95
00:07:54,390 --> 00:07:57,450
So now we must index this second layer array.

96
00:07:58,470 --> 00:08:03,660
So how we can do that, we're going to say, Well, I want the thing at position one.

97
00:08:03,930 --> 00:08:06,390
So we have position zero, position one.

98
00:08:07,290 --> 00:08:08,910
So that's going to be right here.

99
00:08:09,030 --> 00:08:14,400
And so what we can do when we look at our grid is we can narrow it down to be this exact position right

100
00:08:14,400 --> 00:08:17,010
here, we draw a line out to how we draw.

101
00:08:17,070 --> 00:08:21,750
So we come here and we know what's on this row and we know it's here and so we can draw a line right

102
00:08:21,750 --> 00:08:22,800
here to this value.

103
00:08:23,910 --> 00:08:28,230
And that is what this syntax returns to us.

104
00:08:28,620 --> 00:08:29,640
It will be zero.

105
00:08:32,600 --> 00:08:38,030
So now that we know how to index it, how would we populate this to the era?

106
00:08:38,060 --> 00:08:42,650
So let's say we just declare it when we declared it before.

107
00:08:43,190 --> 00:08:45,940
You know, obviously this wouldn't be filled with stuff.

108
00:08:45,950 --> 00:08:51,230
All we said was my we are declaring an array that is size.

109
00:08:52,340 --> 00:08:54,420
Three rows, three columns.

110
00:08:54,440 --> 00:09:00,500
It's actually going to look like this when we declare it's an empty right, it's an empty structure

111
00:09:00,830 --> 00:09:06,020
of, you know, it's just waiting for stuff to be populated and set aside the space.

112
00:09:06,320 --> 00:09:08,030
But we haven't put anything in it yet.

113
00:09:09,770 --> 00:09:11,950
So how would we populate this 2D array?

114
00:09:12,530 --> 00:09:18,680
Well, you probably can take a guess since I mentioned it kind of before we're going to use a nested

115
00:09:18,680 --> 00:09:20,180
loop to populate it.

116
00:09:20,780 --> 00:09:23,870
And so I'm not going to give you the straight up code.

117
00:09:23,870 --> 00:09:28,250
I'm going to give you something called pseudo code, which is only partial code.

118
00:09:28,610 --> 00:09:34,220
It's kind of a mix between, you know, written spoken language and code.

119
00:09:34,490 --> 00:09:38,800
So that way, I think I can explain the concept to you.

120
00:09:38,810 --> 00:09:43,940
You can remember back to how you have learned to use the nested loops.

121
00:09:44,300 --> 00:09:48,410
And then we will we will try and solve this together.

122
00:09:48,470 --> 00:09:48,920
All right.

123
00:09:49,820 --> 00:09:54,160
So let's look at how the populating the 2D array would would work out.

124
00:09:54,170 --> 00:09:59,810
So you see a for loop in a nested for loop inside right here, right?

125
00:10:00,830 --> 00:10:04,580
And we're assuming that we've already declared this in the code.

126
00:10:04,850 --> 00:10:08,460
This is just the populating the array part of the code.

127
00:10:08,480 --> 00:10:11,120
Of course, you'll have other stuff in your program, right?

128
00:10:11,960 --> 00:10:16,310
But we're not mentioning that we're focusing on this right here in the part of the code that populates

129
00:10:16,310 --> 00:10:18,320
the two dimensional array.

130
00:10:19,760 --> 00:10:28,130
Outer layer, rib, outer layer, loop, say outer layer loop is going to be looping over the number

131
00:10:28,130 --> 00:10:28,940
of rows.

132
00:10:30,200 --> 00:10:32,150
How many rows is going to be three?

133
00:10:32,450 --> 00:10:35,510
So I'll let you think about that, how you'd be able to code that.

134
00:10:35,990 --> 00:10:37,970
Then we enter that.

135
00:10:37,970 --> 00:10:45,080
And for each one of the rows, we now need to focus on a column for each row member we're talking about.

136
00:10:45,080 --> 00:10:47,960
Each row is a it's an array in itself.

137
00:10:48,320 --> 00:10:53,300
And now we need to focus on inserting values into each one of these arrays.

138
00:10:53,660 --> 00:10:53,990
Right.

139
00:10:54,830 --> 00:10:59,180
So we do that with the inner loop and then we loop over the number of columns, right?

140
00:11:01,330 --> 00:11:07,590
Then inside this inner loop is where we actually insert the values, and what we do is we index my my

141
00:11:07,750 --> 00:11:16,000
array with the row and the column just like I showed you before, remember with this row and column.

142
00:11:17,170 --> 00:11:25,210
And then we can calculate our product and assign it to that specific location inside the two dimensional

143
00:11:25,210 --> 00:11:25,510
array.

144
00:11:26,470 --> 00:11:28,480
So let's go ahead and step through this.

145
00:11:29,260 --> 00:11:37,990
So first time that I hit this line, it's going to be when the row is zero and the column is zero.

146
00:11:38,170 --> 00:11:40,330
And so we put R0 there, right?

147
00:11:43,260 --> 00:11:49,840
Next, it goes back up to the fore, and we're still going to loop because we're not done yet, right?

148
00:11:49,860 --> 00:11:55,680
We're looping for, you know, something like this, lying is the column.

149
00:11:55,680 --> 00:12:00,210
It's less than three and we go down here and we add the next one, right?

150
00:12:01,380 --> 00:12:03,390
We increment, we add the next one.

151
00:12:05,080 --> 00:12:14,080
Now we notice that we're over our size for the row, so we're going to be done with this inner loop,

152
00:12:14,080 --> 00:12:18,400
so we go back into the outer loop, we're not done with the outer loop yet, though we still have some

153
00:12:18,400 --> 00:12:19,570
more spots to fill, right?

154
00:12:20,110 --> 00:12:25,510
So we go back to the inner loop, we fill each spot one to three.

155
00:12:26,530 --> 00:12:33,790
Then we go back to the hourly, if we go to the next row down here in our loop, we fill column one

156
00:12:34,390 --> 00:12:38,080
column, two column three, which is position zero, one and two.

157
00:12:39,310 --> 00:12:42,820
We notice we're done with this inner loop and now we've filled everything.

158
00:12:42,820 --> 00:12:48,700
We are done with the outer loop, so we are completely done filling the grid for the multiplication

159
00:12:48,700 --> 00:12:49,120
table.

160
00:12:51,470 --> 00:12:57,320
So with that, let's see if you can write this as a full program.

161
00:12:58,700 --> 00:13:04,550
So I believe that with what you've seen so far, you are capable of at least partially figuring out

162
00:13:04,550 --> 00:13:06,680
how to rate this program, if not all of it.

163
00:13:07,070 --> 00:13:08,810
So try and use what you've seen so far.

164
00:13:08,810 --> 00:13:15,170
If you need to go back in the lecture and look at some things to kind of refresh and what we just talked

165
00:13:15,170 --> 00:13:21,080
about and you know, if you if you've forgotten kind of a few the things on the previous life, go ahead

166
00:13:21,080 --> 00:13:21,650
and do that.

167
00:13:22,760 --> 00:13:27,860
But you what you want to do is make a full program that not only fills this multiplication table of

168
00:13:27,860 --> 00:13:28,970
three by three.

169
00:13:29,390 --> 00:13:31,880
You also want to print it out.

170
00:13:32,390 --> 00:13:35,810
So here's some questions you're going to have to answer for yourself.

171
00:13:36,320 --> 00:13:41,390
How are you going to print it out to make it look like the table in the slides?

172
00:13:42,410 --> 00:13:49,400
And then inside of that question is kind of like when should you print a number versus printing a new

173
00:13:49,400 --> 00:13:54,770
line which is slash in or in in the line, you know, using end lines and go to a new line?

174
00:13:56,090 --> 00:14:00,920
Another thing that may or may not seem straightforward to you is what things are you multiplying to

175
00:14:00,920 --> 00:14:02,840
field values in the table?

176
00:14:04,490 --> 00:14:06,110
So you want to make it?

177
00:14:06,110 --> 00:14:07,340
Not necessarily.

178
00:14:07,340 --> 00:14:15,110
It doesn't have to print the row labels and column labels, and it doesn't need to print these square

179
00:14:15,110 --> 00:14:15,740
brackets.

180
00:14:16,460 --> 00:14:22,010
But it should look something like if you just look at the positions of all these values, you know,

181
00:14:22,010 --> 00:14:27,550
it should be like zero zero zero with spaces in between zero zero zero.

182
00:14:28,070 --> 00:14:32,720
Go to another line zero one to go to another line at the zero to four.

183
00:14:33,110 --> 00:14:33,560
All right.

184
00:14:34,640 --> 00:14:36,620
So that is what you should be printing out.

185
00:14:38,020 --> 00:14:44,320
So go ahead and pause the video, and I think this is very important, you should really push yourself

186
00:14:44,740 --> 00:14:48,640
to try and figure this out before I go over the solution.

187
00:14:48,880 --> 00:14:54,310
This is really in the end, what's going to get you the most out of this course?

188
00:14:54,850 --> 00:15:01,180
The more that you attempt these things on your own without just going straight to the solution, the

189
00:15:01,180 --> 00:15:06,280
better off you're going to be in the end and the more comfortable you're going to be when you're trying

190
00:15:06,280 --> 00:15:12,070
to put everything together and really trying to get yourself out there and get a job and achieve your

191
00:15:12,070 --> 00:15:13,240
goals and all this stuff.

192
00:15:14,470 --> 00:15:17,650
Programming is about problem solving in the end.

193
00:15:18,400 --> 00:15:23,320
All of these other syntax, things and tools they can all be learned or taught by.

194
00:15:23,320 --> 00:15:25,960
A lot of people are really anyone, you know?

195
00:15:25,960 --> 00:15:32,320
But what I'm trying to do is just show you that and get you to use it and solve your own problems because

196
00:15:32,620 --> 00:15:35,830
problem solving is something that's harder to teach.

197
00:15:36,250 --> 00:15:41,290
So the more you try it on your own and push yourself, the better you'll be in the end.

198
00:15:42,070 --> 00:15:44,320
So with that, go ahead and pause the video.

199
00:15:44,320 --> 00:15:48,730
See if you can make a full program that fills this multiplication table.

200
00:15:48,730 --> 00:15:55,450
It only has to be a three by three three rows, three columns and then go ahead and print that to the

201
00:15:55,480 --> 00:15:56,560
table out.

202
00:15:58,940 --> 00:16:04,400
OK, so now I'm going to go ahead and get out of here and go on to the ED and we're going to go over

203
00:16:04,400 --> 00:16:05,360
the solution.

204
00:16:06,470 --> 00:16:11,660
So I've already kind of set up a program here that's just empty.

205
00:16:12,710 --> 00:16:14,490
So what are we going to do right off the bat?

206
00:16:14,510 --> 00:16:16,280
Let's go ahead and make our array right.

207
00:16:16,280 --> 00:16:19,850
So I'm just going to call this moss table.

208
00:16:21,800 --> 00:16:27,020
It's going to be a three by three array or matrix.

209
00:16:28,820 --> 00:16:31,970
Then I can get into filling it right off the bat.

210
00:16:31,980 --> 00:16:37,760
So I'm going to make a nested for loop just like we were talking about or I'm going to say four and

211
00:16:38,240 --> 00:16:40,790
are four rows equals zero.

212
00:16:41,420 --> 00:16:46,970
Row is less than three because we're looping over the positions zero and one and two, right?

213
00:16:48,100 --> 00:16:49,160
Five plus plus.

214
00:16:50,390 --> 00:16:55,070
Then I'm going to start another loop and I'm going to say and C equals zero.

215
00:16:55,310 --> 00:16:58,040
C is less than three as well four columns.

216
00:16:58,430 --> 00:17:00,590
And I'm going to say C++.

217
00:17:01,850 --> 00:17:02,890
Pretty punchy right there.

218
00:17:03,110 --> 00:17:03,920
C++.

219
00:17:05,960 --> 00:17:12,170
And now what we're going to do is do our multiplication part, right, so I'm going to say more stable

220
00:17:14,360 --> 00:17:20,630
index the row, then index the column and this is what we're counting over, right?

221
00:17:20,940 --> 00:17:28,400
So when let's take the first iterations, for example, so we enter this four loop gets set to zero

222
00:17:28,400 --> 00:17:28,970
for the start.

223
00:17:29,270 --> 00:17:30,530
We enter this four loop.

224
00:17:30,540 --> 00:17:32,210
See, it's set to zero for the start.

225
00:17:32,240 --> 00:17:33,470
We hit this line.

226
00:17:33,980 --> 00:17:38,860
It says more table zero rows zero column zero.

227
00:17:38,870 --> 00:17:40,040
What is that going to be?

228
00:17:40,070 --> 00:17:44,000
Well, it's just simply going to be zero times zero right that upper left corner.

229
00:17:44,450 --> 00:17:47,000
Each time is just going to be the row times the column.

230
00:17:47,000 --> 00:17:47,780
So that's what I'll do.

231
00:17:47,780 --> 00:17:49,190
I'll St Row Times column.

232
00:17:51,560 --> 00:17:58,700
So what this will do is it will, you know, put this in the correct location.

233
00:18:01,210 --> 00:18:07,300
So we're filling our table like this, and, you know, of course, what we could do is almost just

234
00:18:07,300 --> 00:18:09,730
print this out all in one loop.

235
00:18:09,820 --> 00:18:15,580
I show you how sorry all in one nested loop structure like this, we wouldn't have to do it again.

236
00:18:15,590 --> 00:18:16,870
So I'd do that afterwards.

237
00:18:16,870 --> 00:18:20,910
But let's separately fill our table for now and then we will print it out.

238
00:18:20,920 --> 00:18:24,190
So this is all we need to completely fill our table.

239
00:18:25,810 --> 00:18:30,070
So now I'm going to write another kind of nested form of structure like this.

240
00:18:30,080 --> 00:18:31,780
It's going to be exactly the same.

241
00:18:31,780 --> 00:18:35,590
So I might as well actually just copy this and paste it here.

242
00:18:37,270 --> 00:18:40,120
But now what we're doing is we want to print this out.

243
00:18:40,120 --> 00:18:48,940
So I'm going to say, see out and I'm going to do more table row column and then I'm going to put a

244
00:18:48,940 --> 00:18:50,170
space in between.

245
00:18:51,160 --> 00:18:55,900
So when I'm printing out, remember the inner loop is for printing out the.

246
00:18:58,500 --> 00:19:00,650
Columns for a specific row.

247
00:19:02,130 --> 00:19:03,730
So how do we want to print this out?

248
00:19:03,750 --> 00:19:07,110
Well, let's say we're on rose zero to start with, right?

249
00:19:07,110 --> 00:19:08,850
So our equals zero.

250
00:19:09,810 --> 00:19:16,290
We want to basically print out each column in that row and then we want to go to the next line and then

251
00:19:16,290 --> 00:19:21,000
we want to print out each column in that row and then go to the next line and do the same, right?

252
00:19:21,600 --> 00:19:27,180
So because of that, I'm going to make sure that I don't put it in line here when we're printing each

253
00:19:27,180 --> 00:19:29,970
column for that first or second or third row.

254
00:19:30,330 --> 00:19:32,700
We're just going to print out the numbers with a space.

255
00:19:33,690 --> 00:19:40,860
Once this whole loop has ran for three times and it's done each column for the first row, for example,

256
00:19:41,460 --> 00:19:43,950
then I can print out a new line.

257
00:19:44,160 --> 00:19:47,160
So I'll just see out in line it'll go to the next line.

258
00:19:47,610 --> 00:19:53,850
We will increment our row to the next row, so we go down one row and then we'll run this inner loop

259
00:19:53,850 --> 00:19:56,670
and do each one of the columns for that next row.

260
00:19:57,060 --> 00:19:59,850
Then we can go to the next line and so on and so forth.

261
00:20:00,120 --> 00:20:05,910
So that is why I'm putting the sea out in line after this loop and the inner loop, right?

262
00:20:05,940 --> 00:20:09,240
And inside this, we just print each column on the same line.

263
00:20:11,110 --> 00:20:13,370
So let's go ahead and see how this looks.

264
00:20:13,390 --> 00:20:20,380
I'm just finishing up the function there and I'm going to file save and then I am going to go ahead

265
00:20:21,730 --> 00:20:31,630
and I'm going to compile this and run it and look at that, that prints out our table pretty nicely

266
00:20:31,630 --> 00:20:31,990
there.

267
00:20:32,080 --> 00:20:38,800
So we have this zero zero zero zero one two zero two four.

268
00:20:40,210 --> 00:20:41,650
So pretty nice.

269
00:20:42,400 --> 00:20:47,530
So what we could do is like we wouldn't even necessarily have to fill an array for this.

270
00:20:48,130 --> 00:20:55,240
But it's important to know how to make the matrices and stuff like that because we're actually going

271
00:20:55,240 --> 00:21:00,850
to be starting our first project soon and it's going to involve matrices.

272
00:21:01,690 --> 00:21:05,050
So we're going to need to know how to use these 2D arrays.

273
00:21:06,380 --> 00:21:12,200
But what could actually happen is we could just print this out, so if we didn't care about a matrix,

274
00:21:12,470 --> 00:21:19,220
you know, this program could actually become simpler and we wouldn't even need an array.

275
00:21:19,640 --> 00:21:24,050
We could honestly just go through and we could print out this.

276
00:21:24,050 --> 00:21:29,270
Our times, see, so I could just say, see out our time.

277
00:21:29,270 --> 00:21:29,870
See?

278
00:21:30,470 --> 00:21:33,050
And then I could do a space and like that.

279
00:21:33,050 --> 00:21:35,450
And then I could say, see out in the line.

280
00:21:35,930 --> 00:21:43,360
And if I was to save this and run this, I'm on a clearance and pilots run it.

281
00:21:43,370 --> 00:21:46,760
You notice that it prints out the same exact thing.

282
00:21:46,760 --> 00:21:54,800
So we it's kind of would seem pointless if to, you know, make this 2D array for this specific program.

283
00:21:55,250 --> 00:22:02,960
But the main purpose was having you figure out how to populate this two dimensional array and then know

284
00:22:02,960 --> 00:22:05,210
how to print out from a two dimensional array.

285
00:22:07,410 --> 00:22:10,560
So pretty cool, pretty cool.

286
00:22:11,640 --> 00:22:20,160
I think that what we will do is go over some practice problems with these may be just a few, maybe

287
00:22:20,160 --> 00:22:20,820
one or two.

288
00:22:21,930 --> 00:22:24,330
And I will do that in the next lecture.

289
00:22:24,690 --> 00:22:33,750
And after that, I think that we will be pretty much ready to have you start the first project, which

290
00:22:34,260 --> 00:22:41,520
will be a Tic TAC toe game actually where we're going to make that full game and be able to have multiple

291
00:22:41,520 --> 00:22:42,120
players.

292
00:22:42,480 --> 00:22:48,150
And we're going to be using a table for a Tic-Tac-Toe table, which is going to be an array like this.

293
00:22:48,930 --> 00:22:57,390
I think in the next lecture, we'll go ahead and just convert this program to a dynamic array and then

294
00:22:57,390 --> 00:23:01,950
we'll just mess around with kind of 2D dynamic arrays and stuff like that.

295
00:23:02,670 --> 00:23:02,930
All right.

296
00:23:02,940 --> 00:23:05,670
So with that, I will see you in the next lecture.
