WEBVTT

00:00.320 --> 00:06.440
Now, we will continue our program and we will write the main function here.

00:06.440 --> 00:10.570
So we will need to set an initial seed value to the system clock here.

00:10.580 --> 00:21.440
So in order to do that, as rand here, static as Rand static cast, we're going to use it static static

00:21.440 --> 00:21.860
cast.

00:21.950 --> 00:29.000
And we will into this braces here, we're going to use unsigned integer unsigned integer.

00:29.120 --> 00:32.060
And after that we're going to use the time.

00:32.660 --> 00:38.780
So the time is going to be the best is zero time, the zero.

00:38.780 --> 00:41.660
And then after that we will.

00:42.880 --> 00:46.240
Need to generate a random seed and element cart.

00:46.240 --> 00:47.800
So in order to do that.

00:47.830 --> 00:52.840
Integer rand suite or let's make it the.

00:54.360 --> 00:54.750
Yeah.

00:54.750 --> 00:57.150
My, my sweet, my sweet.

00:57.150 --> 01:01.380
And we will use the generate random number function here.

01:01.530 --> 01:07.200
Generate random function that gives us an random obviously.

01:07.200 --> 01:13.710
So now generate random number we will give it some 023.

01:14.620 --> 01:17.800
So, as you know, we have.

01:18.810 --> 01:22.490
From 0 to 3 card switch here.

01:22.500 --> 01:30.420
So in this case, it's zero one, two, three, three here.

01:30.420 --> 01:42.300
So our code here will generate from 0 to 3, not random number here, so zero and three.

01:43.540 --> 01:47.140
And after that we will also need to generate an element.

01:47.140 --> 01:50.080
So integer my element here.

01:50.110 --> 01:55.470
The generate generate generate random number here.

01:55.480 --> 01:57.670
Of course it's going to start with from zero.

01:57.670 --> 02:01.390
And let's watch actually what we need to write it here.

02:01.630 --> 02:08.560
So in this case it's one, two, three oh no, zero from zero.

02:08.590 --> 02:14.320
As you learned in previous lectures, the N starts from zero by default.

02:14.320 --> 02:21.100
So zero, one, two, three, four.

02:22.530 --> 02:23.190
Five.

02:23.680 --> 02:24.730
Six.

02:25.270 --> 02:26.290
Seven.

02:27.430 --> 02:28.180
Eight.

02:28.330 --> 02:29.440
Nine.

02:29.770 --> 02:30.700
Ten.

02:31.700 --> 02:35.510
11 and 12 here.

02:35.570 --> 02:37.550
So we're going to make it 12.

02:37.880 --> 02:42.500
So it will generate a random number from 0 to 12.

02:42.530 --> 02:48.010
So actually, we have some problem here, as you can see, generate.

02:48.020 --> 02:49.370
So we need to write it like that.

02:49.370 --> 02:55.420
But it's not a problem for the compiled base, but it's like looks awkward.

02:55.430 --> 03:02.480
So gener generate here, we refactored it and everything looks fine.

03:05.040 --> 03:05.670
Yeah.

03:06.300 --> 03:06.810
Okay.

03:07.170 --> 03:16.460
So now, since we have received our codes, now we need to make a static cast here.

03:16.470 --> 03:20.880
So here the card suits.

03:20.880 --> 03:24.450
So the card suits the suit.

03:24.480 --> 03:24.750
Here.

03:24.750 --> 03:32.370
We're going to use the static cast and we will use the card card elements, which is going to be we

03:32.370 --> 03:39.630
will pass in my my element or my suit firstly, and then we will pass my element.

03:39.750 --> 03:42.690
So here we have already defined it, I think.

03:42.720 --> 03:43.320
Yeah.

03:44.210 --> 03:47.210
Variable comes with an R value of card elements.

03:47.240 --> 03:47.960
Yeah.

03:47.990 --> 03:50.360
Card switch needs to be card switch.

03:50.390 --> 03:50.840
Of course.

03:50.840 --> 03:52.160
Card switch here.

03:52.160 --> 04:00.020
And after that we will use the card elements and element here the staticcast again and we will pass

04:00.020 --> 04:01.090
instead of Cardsuit.

04:01.160 --> 04:03.590
We will pass the card elements.

04:03.590 --> 04:07.250
And here, my sweet, here.

04:07.580 --> 04:09.080
Oops, my element.

04:09.080 --> 04:09.560
Oops.

04:10.280 --> 04:12.110
My element.

04:12.110 --> 04:13.340
My element.

04:17.420 --> 04:17.610
Hmm.

04:17.870 --> 04:18.520
Oh, yeah.

04:18.620 --> 04:20.000
Yes, We have to write it like that.

04:20.000 --> 04:21.680
So it's fixed.

04:22.790 --> 04:26.150
And now we will print this on the screen.

04:26.150 --> 04:29.000
So we will use a print with a C out.

04:29.030 --> 04:31.130
C out the.

04:31.130 --> 04:34.880
Your card is here.

04:37.940 --> 04:41.450
Your card is and we will see out again.

04:41.600 --> 04:43.370
Get element.

04:43.400 --> 04:44.990
Get element.

04:44.990 --> 04:45.710
String.

04:45.710 --> 04:48.680
And with the get element string.

04:48.710 --> 04:51.930
As you can see here, we need to pass some arguments in it.

04:51.950 --> 04:58.200
So just I'm waiting for your answer and stop this video and write your own code here.

04:58.220 --> 04:59.630
What we need to pass here.

04:59.630 --> 05:00.230
Here.

05:03.870 --> 05:08.190
So we need to pass here the sweet.

05:09.420 --> 05:14.370
So, uh, the first, of course we need to pass it element and then we will pass through it here.

05:14.370 --> 05:20.160
So first this goes here, the element class here, because we will get elements to string here.

05:20.280 --> 05:24.990
So element and here.

05:25.020 --> 05:27.450
See out get.

05:28.910 --> 05:32.480
So we need to almost make it like this.

05:32.480 --> 05:36.110
So our suite is off here.

05:37.970 --> 05:39.140
The get.

05:39.890 --> 05:41.660
Suet shrink.

05:42.650 --> 05:45.500
And obviously we need to pass here.

05:46.420 --> 05:47.560
The sweet variable.

05:49.080 --> 05:51.300
And here we will write the sweet.

05:52.790 --> 05:55.160
And after that, of course, end line.

05:56.790 --> 05:59.070
And after that we will return zero.

05:59.070 --> 06:00.780
So we already written it here.

06:04.170 --> 06:12.540
So from this code you can see that we can access the enum data using an integer value.

06:13.410 --> 06:13.970
Here.

06:13.980 --> 06:24.090
So however, we have to cast that integer value so that it can fit the enum data using the static cast.

06:24.740 --> 06:28.880
So and as you can see here, we did it with, like, that card.

06:28.880 --> 06:29.960
Sweet, sweet.

06:29.960 --> 06:31.330
And we write it.

06:31.340 --> 06:36.470
The static cast, my sweet and static cats, my element.

06:36.920 --> 06:40.010
So let's actually run our code here.

06:45.700 --> 06:49.180
To here main dot cpp.

06:50.720 --> 06:53.690
The output is going to be my output.

06:54.810 --> 06:56.070
Or let's.

06:57.110 --> 06:57.930
Random card.

06:57.950 --> 07:04.860
Random card that x here no return statements in a function return void.

07:04.880 --> 07:06.410
So we have.

07:07.610 --> 07:10.280
Error in the 81st line.

07:11.570 --> 07:13.640
So we need to return string.

07:14.720 --> 07:19.460
Yeah, we will write that return string here and everything is fine.

07:20.710 --> 07:21.180
Yeah.

07:21.190 --> 07:22.300
Not return a string.

07:22.300 --> 07:24.520
We need return E here.

07:24.820 --> 07:28.330
So return E and everything fixed here.

07:28.330 --> 07:29.740
And let's check it again.

07:32.560 --> 07:38.680
Yes, it's compiled sales cleaned here and now let's run our program.

07:38.680 --> 07:42.100
So as you can see that this is the random card here.

07:42.130 --> 07:44.770
So random card dot excel.

07:45.070 --> 07:49.060
So as you can see, our card is queen of spades.

07:49.060 --> 07:52.710
Let's seven of spade, Jack of Spade.

07:52.720 --> 07:54.370
Seven of spades, seven of spade.

07:54.400 --> 07:55.480
Jack of Spade here.

07:55.480 --> 07:57.910
Two of spade, Jack of Spade.

07:57.910 --> 08:00.370
And, uh, here.

08:05.870 --> 08:09.230
Let's actually let me look at the lecture time.

08:09.230 --> 08:12.050
So, uh, that's it for this lecture.

08:12.050 --> 08:15.560
And in the next lecture, we will also develop an advanced or application.

08:15.750 --> 08:19.160
As you can see, we got a hell all spades here.

08:19.160 --> 08:20.690
So that's a problem for us.

08:20.690 --> 08:25.460
So we will fix that in next lectures and we will develop our application further.

08:25.460 --> 08:27.080
So I'm waiting you in the next lecture.
