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
All right, so now that you tried to solve this exercise on your own, you gave it your best.
You rode the down the structure, you rode down the functions.
Let us try to take a look at it together.
OK, so first of all, what we are going to do is taking a look at the printing function.
The first function that gets a point variable and printing information.
So first of all, we created the structure of the point that's, you know, how to do it than what we've
done is basically we thought about the function is going to get a point and he's going to print this
information.
So probably this operation is related to the fact that we are going to print and we are going to use
the printing operation for points.
OK, so let's give this function a proper name and call this function.
Print point makes sense, right?
OK, very important.
Not a func not void, func void print point.
We know that what this function does just by taking a look at its name.
In these function, he's going to get it's going to get a point variable.
Here it is.
That's a point variable, be one we could name it any other name, OK?
Here, it really doesn't so much matter, OK?
We can also use some more descriptive name for a point variable, but b one.
I think that it's pretty understandable, OK, whenever we take, when we talk about points.
Now about.
The type of the function, why did we leave it as void?
Well, that's pretty obvious because if we take a look at the definition and it what we were required
to do, we were required to write two functions function, one to get a point variable and then print
out information.
So.
These functions should not return anything.
You can see that there is no word of return there we print.
Yeah, print.
But you know that there is a difference between printing and returning.
So print is used to print the information to the screen.
OK.
And.
You know, that return is basically used between different functions, right, whenever you call a function.
So these function returns to whoever called this function.
So there is a difference between print and return.
And since this function does not, print does not return anything and it's only print and it only prints,
then we can say that it should be of avoid Typekit.
Now what should he do?
Basically, it should execute two lines, two very basic lines.
The first one is print point X equals two percentage D. Simply printing out the basis the basic information
about the X and Y coordinates.
So far, so good.
Awesome.
So.
That's right.
That's a that's function number one done.
Now we are going to talk about function number two, which should be responsible for getting a input
from the user and then return it.
So we will call these function input point and all these function is going to do.
It's going to create a new point.
Let's call it my point.
So first of all, we create a variable of the structure, a point.
Then what do we do?
We ask the user, Please enter x coordinate.
Read this information from the user and store it inside my point got x.
Then we print again.
Enter Y coordinates.
Read the Y coordinate and store both of these values X and Y under my point variable.
That's what we do.
And the final step is we want to return this point that we got all the information about it from the
user.
And the way we do it is simply by specifying the key word return and then the name of the variable.
And what is the type of this variable?
That type of these variable is a point type, right?
Because if we take a look at it, we can see when we created it.
We also specified that it should be of a point type.
So that type of the function is also going to be point since we return a variable of a point type.
Remember this thing right here?
It specifies the type of the return value from a function.
OK.
So if you have a written here and double char, please try to think about it once again.
So now that we have both of our functions, Greenpoint and Input Point, we can move on to see how we
can call them and make some usage out of them.
And so our program will run more smoothly.
So let's take a look at it.
So there is point B.
One equals two input point.
So what happens here?
Basically, when we try to create one, we call this input point function and all of these function
does is basically taking a responsibility for running these intrigues coordinated and their white coordinate
and asking the user for a data to fill up this point.
And then it returns us kind of complete point that we can use for the next of the program.
Then we print P1 one before it changes.
We print this value how we can print P1.
We could also run here and basically write something like that.
So print half print the X and Y coordinates.
But we know that there is a function, a specific function that we've created for this task.
Here it is.
Print point and print point can be called on P1 because it receives a point.
OK.
And all it's going to do is just to print the X and Y coordinates that you received from the user inside
of these function input point.
Right afterwards, we are going to completely modify the X and Y coordinates inside of B one, the score
of the night, we're going to increase by one to incremented and the Y by three.
OK, incremented by three.
And then we are going to call this function pinpoint once again and see if something has changed.
OK, so kind of elegant program, right?
Although we are using a lot of interruptions in a lot of printing with the user.
So now let us run this program and hope for the best that it will work exactly as we expect.
So answer excoriating it.
Let's make it.
I don't know, Tim.
Come on, Tim.
Answer why coordinate?
Let's make it 15.
So be one before it changes was point X equals two, ten point Y equals 215 and B one after the changes
equals two point two x equals to eleven because we incremented it by one and point Y equals to 18 since
we incremented it by three.
So yeah, this is it, guys.
For these video of solutions, we have created a struct we've written two points are two functions that
are probably going to be used a lot.
If you are developing a program to work with points, you are most likely going to need to get the X
and Y coordinates from the user.
For that, you have the input point and also you're probably going to print the point to the screen.
So for that, you have this one.
You can also write down some implementation of your own using some.
Using some parentheses instead of printing out Point X equals to something and point Y equals to something
you can use like point coordinates in parentheses and just percentage a percentage.
That's it.
OK.
And here inside of the main function, we've made a couple of function calls.
We call this function.
We know it returns a point.
And there is a match between them.
We also know that we can call these function print point because if it is of void type, we can call
it.
That's it.
So thank you guys for watching.
Keep on practicing.
I'll see you then.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.