WEBVTT

00:00.600 --> 00:10.530
So there are a couple things I want to do lot done with the number Gasser quite yet in the want to play

00:10.530 --> 00:20.510
again function let's say the user typed in a capital Y instead of lower case y.

00:21.000 --> 00:23.860
Well I want to I want that count.

00:23.940 --> 00:29.310
So I want to be able to say I want that to be yes.

00:29.980 --> 00:38.680
In that case though how I really want to just ignore the chaos of character k.

00:38.860 --> 00:45.680
So you have an ELSE case here and I'm going to say

00:48.290 --> 00:54.360
well some is going nor anything else.

00:55.640 --> 01:01.000
Here.

01:01.100 --> 01:07.780
So say they pressed Y and then like a bunch of other stuff that would still work.

01:07.850 --> 01:08.570
In this case

01:12.120 --> 01:13.230
that's why I'm doing that.

01:13.440 --> 01:24.700
And now I want to check to see well not check but I want to ignore the if it's a y uppercase Y or lowercase

01:24.700 --> 01:39.330
YS How you do that is through this function call to to lower.

01:39.740 --> 01:51.510
To lower takes a character and to learn as part of the CC type header.

01:51.530 --> 01:54.310
So we need to include that as well.

01:56.950 --> 01:58.350
CC type

02:01.680 --> 02:08.360
and this will actually put any input that they set to lower case.

02:09.460 --> 02:17.770
So now if we run it again and let's just say no it is 5.

02:17.830 --> 02:25.290
So would you like to play again this type in the capital Y and then it works OK.

02:27.020 --> 02:31.180
And just for checking lowercase.

02:31.180 --> 02:37.750
Still it works and anything else of course will not.

02:37.980 --> 02:41.830
OK so I just want to fix that quickly.

02:44.030 --> 02:54.650
Now we need to finish the part of the game that said it should change based on

02:59.040 --> 03:00.890
the numbers change each time.

03:01.110 --> 03:01.740
OK.

03:02.700 --> 03:10.960
So how we're going to do that is in fact we need another include here

03:14.310 --> 03:15.210
include

03:18.010 --> 03:31.790
the fact we eat to standard lib h in are going to include something called seedtime K..

03:32.050 --> 03:37.120
And what we're going to use is a random number generator.

03:37.150 --> 03:47.240
So how this random number generator works is we first have to seed the right number generator.

03:47.370 --> 03:52.780
So it has to have a defaults value.

03:54.370 --> 04:03.940
And to use unsigned int and a time function z time library call time.

04:03.940 --> 04:07.560
This just gets the current time.

04:07.570 --> 04:09.470
So just now basically.

04:09.580 --> 04:10.330
OK.

04:10.510 --> 04:13.530
And it doesn't really matter what I use here.

04:13.540 --> 04:21.790
I could just use 0 say but random numbers aren't truly random on computers.

04:21.820 --> 04:24.290
It kind of work based on this seed.

04:24.580 --> 04:31.540
So depending on the seed you give it it'll give different random numbers.

04:32.300 --> 04:40.540
So we have to see the random number generator generator first and then we can get random numbers later.

04:40.870 --> 04:47.540
So now we want to get the random number.

04:47.540 --> 04:59.240
So how you do that is a Rand parentheses like this and this will give you a number believe it's from

05:00.490 --> 05:03.590
zero to Rand Max.

05:03.590 --> 05:04.550
OK.

05:04.930 --> 05:11.200
So but we want it to be from 0 to our upper bound.

05:11.200 --> 05:21.440
So all we have to do is a modulus for bound like this.

05:21.690 --> 05:22.690
OK.

05:23.080 --> 05:26.550
In fact we do.

05:26.730 --> 05:37.240
Now we get like so now you're in this again and we say 65 it's probably not going to be 65.

05:37.240 --> 05:39.240
That was too high.

05:39.630 --> 05:48.610
So let's try to get say 30 is too high will say 15.

05:55.220 --> 05:56.920
Too low.

05:56.950 --> 06:02.710
So we'll say when he fight.

06:02.800 --> 06:04.550
Twenty three years.

06:04.970 --> 06:05.670
Oh yeah.

06:05.680 --> 06:06.710
It's 23.

06:06.800 --> 06:09.950
And he don't want to play it.

06:10.260 --> 06:15.710
So there are some fixes for our game.

06:15.780 --> 06:31.840
So Rand really gives you a random number between 0 and Rand Max and the CC type which is down here to

06:31.840 --> 06:38.320
the two lowers So basically makes any character into a lowercase character.

06:38.490 --> 06:42.710
And so that's it for this game.

06:42.730 --> 06:48.760
So in the next section we're going to start talking about some interesting things called pointer's.
