Now, we will continue our program and we will write the main function here.
So we will need to set an initial seed value to the system clock here.
So in order to do that, as rand here, static as Rand static cast, we're going to use it static static
cast.
And we will into this braces here, we're going to use unsigned integer unsigned integer.
And after that we're going to use the time.
So the time is going to be the best is zero time, the zero.
And then after that we will.
Need to generate a random seed and element cart.
So in order to do that.
Integer rand suite or let's make it the.
Yeah.
My, my sweet, my sweet.
And we will use the generate random number function here.
Generate random function that gives us an random obviously.
So now generate random number we will give it some 023.
So, as you know, we have.
From 0 to 3 card switch here.
So in this case, it's zero one, two, three, three here.
So our code here will generate from 0 to 3, not random number here, so zero and three.
And after that we will also need to generate an element.
So integer my element here.
The generate generate generate random number here.
Of course it's going to start with from zero.
And let's watch actually what we need to write it here.
So in this case it's one, two, three oh no, zero from zero.
As you learned in previous lectures, the N starts from zero by default.
So zero, one, two, three, four.
Five.
Six.
Seven.
Eight.
Nine.
Ten.
11 and 12 here.
So we're going to make it 12.
So it will generate a random number from 0 to 12.
So actually, we have some problem here, as you can see, generate.
So we need to write it like that.
But it's not a problem for the compiled base, but it's like looks awkward.
So gener generate here, we refactored it and everything looks fine.
Yeah.
Okay.
So now, since we have received our codes, now we need to make a static cast here.
So here the card suits.
So the card suits the suit.
Here.
We're going to use the static cast and we will use the card card elements, which is going to be we
will pass in my my element or my suit firstly, and then we will pass my element.
So here we have already defined it, I think.
Yeah.
Variable comes with an R value of card elements.
Yeah.
Card switch needs to be card switch.
Of course.
Card switch here.
And after that we will use the card elements and element here the staticcast again and we will pass
instead of Cardsuit.
We will pass the card elements.
And here, my sweet, here.
Oops, my element.
Oops.
My element.
Hmm.
Oh, yeah.
Yes, We have to write it like that.
So it's fixed.
And now we will print this on the screen.
So we will use a print with a C out.
C out the.
Your card is here.
Your card is and we will see out again.
Get element.
String.
And with the get element string.
As you can see here, we need to pass some arguments in it.
So just I'm waiting for your answer and stop this video and write your own code here.
What we need to pass here.
Here.
So we need to pass here the sweet.
So, uh, the first, of course we need to pass it element and then we will pass through it here.
So first this goes here, the element class here, because we will get elements to string here.
So element and here.
See out get.
So we need to almost make it like this.
So our suite is off here.
The get.
Suet shrink.
And obviously we need to pass here.
The sweet variable.
And here we will write the sweet.
And after that, of course, end line.
And after that we will return zero.
So we already written it here.
So from this code you can see that we can access the enum data using an integer value.
Here.
So however, we have to cast that integer value so that it can fit the enum data using the static cast.
So and as you can see here, we did it with, like, that card.
Sweet, sweet.
And we write it.
The static cast, my sweet and static cats, my element.
So let's actually run our code here.
To here main dot cpp.
The output is going to be my output.
Or let's.
Random card.
Random card that x here no return statements in a function return void.
So we have.
Error in the 81st line.
So we need to return string.
Yeah, we will write that return string here and everything is fine.
Yeah.
Not return a string.
We need return E here.
So return E and everything fixed here.
And let's check it again.
Yes, it's compiled sales cleaned here and now let's run our program.
So as you can see that this is the random card here.
So random card dot excel.
So as you can see, our card is queen of spades.
Let's seven of spade, Jack of Spade.
Seven of spades, seven of spade.
Jack of Spade here.
Two of spade, Jack of Spade.
And, uh, here.
Let's actually let me look at the lecture time.
So, uh, that's it for this lecture.
And in the next lecture, we will also develop an advanced or application.
As you can see, we got a hell all spades here.
So that's a problem for us.
So we will fix that in next lectures and we will develop our application further.
So I'm waiting you in the next lecture.