Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
OK, guys, so what we are going to do right now is to initialise to the clearing, initialise a two
dimensional array and then print all of its values to make sure that everything is actually as we expected
to be.
So let's first of all, initialize some array.
Let's go within my two 2D array.
OK.
So my two dimensional array and let's go like with two rows and let's make three columns, OK?
Doesn't really matter.
And now we are going to also specify its values.
So we know that we have here two rows in three columns.
And for the first row we will specify the values like let's say one, five and nine.
And for the second column, we are going to use just even only even numbers.
So it's going to be like, let's say two, six and 10.
OK, so that's how we are going to feel, our new two dimensional array.
Now, what we have to do is print all of its values.
So how basically should you approach this task?
So one of the things to do here is to understand that we are working with a two dimensional array and
he'd have to access it has rows and it has columns.
So what we will have to do is to iterate over all the rows, OK, over all the rows.
So meaning we will need to create some additional variable.
I will need to iterate over all the rows.
So for I equals to zero I less than two.
Right.
We have here only two rows.
We are going to iterate over all the two rows and rows zero and it's row one and of course C++ to incremented
for the duration.
And for every row that we are going to iterate we need also like when we worked in print, one dimensional
arrays.
We need to print every value in this row, meaning we need to pass over all the columns in this given
row.
So we will need additional inside loop, OK, and nested loop that will iterate over all the elements
for each given row.
So for that, we will use additional, let's say, the assisting variable colleague J.
And we will use here this internal for a loop.
So it will be like this.
So for J equals to zero as long as J is less than three, because we have here the number of columns
is three and on every duration plus.
Plus meaning what does it mean, this internal or nested loop we have here, the outside loop which
basically says that go over all of the rows.
OK, one by one, one by one.
And here.
OK, let's use it like this.
I like this representation the most one by one in here.
Go over.
Go over all of it columns, all the columns of a given row that you are already in.
So for the first row, ok, I equals to zero.
We are going to iterate over all of its columns and then we are going to print each and every one of
these elements.
So basically the only thing that remains to do here is just to like, OK, what happened?
Why is that these.
Wait.
OK, so let me just fix this one for you.
OK.
So all very strange.
OK, so never mind.
I will just use a tab to move it here like this.
OK, so we are going to use print F into print the value of these rows of percentage.
OK, let's leave some space here and also specify the value in what will be the value.
It will be my two dimensional array at index what index it what row at row I and it.
What column it.
Column J.
And that's it.
That's how we are going to iterate over everything here.
So let's just use here.
OK, never mind, let's just try to build and run it.
So go here, build and run Lola.
And what we can see here, basically what you can see is that all the values were printed one after
the other.
So one five nine, which is the exact ichi's, which is exactly our first row.
And then you have to 610, which is exactly the second row.
It's.
Once again, we iterated over all the rows by taking one row and iterating and printing all of its values,
going over all of its columns, and basically once we are done with one row, we incremented, I buy
one and we moved to the next row.
So I want to print these.
Instead of just pointing it out in one line, I want to print it out in like, you know, kind of a
grid, like we think about two dimensional array with rows and columns.
So one way to do so is to understand that on every every row, once we've done printing all the values
for a given row, we would like to print a new line.
So print out and here, just use backslash N and let's see what happens now.
OK, so build and run it.
And what you will see is that nothing happened.
So why is that?
We can see only after after we have exited these for a loop at the end.
So just a new line before the return.
So what was the problem?
The problem is very simple.
We didn't use curly brackets to specify that inside of these out for a loop, there will be more than
just one command.
We talked about it when we learned how to use for loops.
So that's how you are going to use it.
OK, so four, four, four.
And also here we are going to close it.
So now these printer line will be under these out outside there are for a loop.
So let's build and run it once again.
And there you go.
We have our two dimensional array printed to the screen.
So you iterate over the first row, like with I equals to zero, go over all of the elements, all of
the columns, print them, then you print enter, you move on to the next line and then you go once
again.
You do so four to six in 10 and then you come here.
You see that I equals two.
Two two is not less than two.
Then the condition this condition is false and you go and return zero to indicate the success of your
program.
So that's it.
That's it guys.
And one thing that I want to ask you is in the previous videos we've seen and I showed you a lot of
examples, not a lot of but a couple of examples with different types of two dimensional arrays and
with different options for initialization.
And what I want to ask you to do is like a little homework, small task, you know how to print all
the values of a two dimensional array now.
So go and initialize these values like you've seen in the previous videos.
Go and like make some hands on, make some practice here.
Instead of these percentage.
They think of what it should be, maybe should be percentage C or percentage F or L F, whatever it
is, and initialize different sizes of of two dimensional arrays use.
Here's one of our three options that we talked about.
Maybe should be like this one five, OK, and build and run it and just work with it and make sure you
understand everything that we spoke about in our previous videos and that you are ready to move on with
our two dimensional arrays.
So thank you guys for watching and I will see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.