All language subtitles for 4. Challenge 1 - Initialize & Print Date Variable

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

What is going on, guys, in this video, what we are going to do is to give it a little bit of practice

to our structure usage.

So first of all, what I want us to do is to write a simple program that will create a structure of

point.

So there you go, struct the keyword struct.

And we use the point as its name is we've seen in one of our previous videos.

So we create a strong point structure.

So now what we will have here is simply the fields associated with these templates.

So intakes and Ayinde.

Why that's it.

So what we created here.

OK, make sure that it does not it is not created inside of a given function.

It is created outside.

We simply created a bit of a structure, a template that now from this template we will be able to create

variables of this type.

So let's say, for example, we wanted to create a variable of a point type.

So what should we use?

Should we simply first of all, let's remove this print.

Hello, world.

Should we use something like that point?

Let's say P1.

OK, so point B one.

Is that OK?

Will it work?

Let's try to build and run it.

So let's build and run them.

There you go.

You can see here a problem.

You can see here where it is unknown type, name, point.

So why can't we create a point variable p one is the name point is a structure, a template.

And the reason is very simple because if we want to create a variable, at least for now, OK, for

now, for later, later on, we will also learn how to use the TYPEDEF in one of the future videos in

this section.

But for now, if we want to create a structure point variable, we need to use all of these syntax.

So struct point, OK, struct point.

We create, we specify the type, OK, just like you used int X and Y and Z, whatever.

You specify the type and the type of struct point and the variable name.

And now if you build in runni just to make sure that everything works, you will see that OK, the problem

runs.

Nothing happened because we didn't print anything and we didn't read anything from the user.

But what we can make sure is that these program works and these syntax is probably OK.

Right.

All right.

So also what we want to do is let's say we want to like to access these fields and to set some values

inside of them.

So let's use just print have enter, let's say X coordinate, OK, and also use it something like that.

And also what we would like to use is hanser the Y coordinate and we are going to use this kind of function

to read these values and to store them.

Where are we going to store them inside of P1.

Is that OK if we are going to use it this way?

Probably not, because what we need to specify is the exact field that we want to store the value of

X that we want to read from the user, from the console.

So be one X and use an ampersand here.

And also we are going to use the same for P dot y.

So there you go.

You simply are read the values of X and Y from the user.

And finally, just to make sure that everything worked, OK, OK, because we just simply practice in

some Hands-On.

So print f print f the value of the point is and let's use here percentage and percentage just like

you to show it in coordinates.

And what also we want to specify is P1 and B1 dot y.

That's how you do it right now.

Let's build and run this program and see what happens.

So answer Corradini, let's say five and let's say the Y coordinate would be seven.

So the point is five seven and that's seems to be working.

OK, now let's make an additional example of struct data.

So struct to date, I love this example.

I use it a lot of times when I explain this topic to you, my students.

So you're probably going to see a couple of examples that we use.

Struct date.

So struct date and there you go.

You specify now the fields inside of the struct.

So each day int month and int year.

All right, guys, once again, we did not create a variable.

We just created.

Template.

You not what we are going to do is something very, very similar, we are going to modify this program

a little bit.

We are going to create, let's say, my my date one.

OK, so my each one will be our variable and it will be of a struct daytime.

OK, so that's how you create a structured variable.

And in our case, the name is my date one and that's OK.

You can also use herea the date of birth and whatever date of anniversary.

Date of when you graduated or whatever.

OK guys.

So my date one is just graduate you eight date.

This will be the date of your graduate graduation.

OK, something like that.

So now let's move on and print our answer.

Let's say a day, OK?

And today, when you graduated, answer what?

Here we have enter month month.

And also what we need to add is enter year.

Right.

And what we want to do is read these values and to store them inside of grade date today.

OK, so the same we will do for month, for month and the same four year.

OK, so that's simply how we read the values for each of the fields off the graduate date variable that

we've just created.

That's how you do it.

And if we want to print the full date so we can say the day the graduation date is and let's use something

like that.

OK, I don't know.

Let's use here a percentage, the percentage and percentage the and for the first one we will use let's

see the year, the month, whatever you like in every country, these different formats.

So we can specify first of all, the month, OK, so we will use graduate date grudge you what happened

here.

Graduate day to month, graduate date dot.

They can graduate date dot.

Yea that's it.

And now we are going to build and run it and we are going to see what happens.

So let's see the five month six in the year.

Twenty twenty one.

So the graduation date is on this date and that's freaking awesome guys.

You see that the program works exactly as expected.

And if we want to go over all the steps one by one, quickly, briefly summarizing, first of all,

what we do, we create a structure template specifying the structure, name specifying the fields the

structure is going to have in this case, it's day, month and year, all of them of type.

And in this case, it's and to our X in why there is no reason why we could not have used something

like that float and float y or even one or even one of them will be OK.

There is no problem in mixing up different data types, different types of variables in a structure

template.

That's OK.

And what we have done afterwards is that we created a new variable called graduate date of type structure

date, read the values for the fields from the user and then simply printed out these values to the

screen.

So I think it's very hard not to understand this flow if you go exactly by the steps I've just mentioned.

So I think that's enough for our initial practice.

Guys, thank you so much for watching.

Keep on practicing.

These function are in these structures on your own.

Run the code, make sure that everything works as expected 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.