So over some odds and ends.
But I noticed that I made a mistake in the imitation last time if want.
Is a point to her break statement.
So if you saw before it actually outplayed both this and this.
When we lost.
OK.
So always remember the break statements.
So just being a little bit careless there.
So now that we have this fixed this is a major implementation of it.
There's a couple things I want to do though to make our life easier.
So one of those things is going to so far we've only had one kind of big file of stuff of code and I
want to be able to reuse some of the code that we have.
So for example this character that has the prompt in the air and also this character which has the valid
inputs.
OK.
So how I'm going to do that is I'm going to say right click on this source.
So the source of this fact that's yeah that's fine.
Right click on the source and you say new header file and we're going to say we're going to call it
utils.
So for you to see finish
this and call it Eutelsat each actually going in or open this and we're going to have a what's called
a header file and this header file will have some sort of declarations of our of our kind of utility
functions that.
Yeah.
So example one of the utility functions we have is this good character.
So are you going to copy this
and paste it in our header file this.
And we're going to do the same thing for this other function to
copy that paste it over
so
we have this header file now and release something with the preprocessor and rushing to say hash if
in def.
And or and say You too.
So your score is going to say I'm just going to score you two.
It's underscore each every state irritated fine score on the score you tildes each school score that
and are going to say.
And if so what this will do is remember I said.
These include statements.
So if you go to hangman P and go all the way up to the top These include statements will actually paste
in the entire.
So I said before like the entire tired IO stream gets pasted in.
We have this so that it doesn't get pasted in multiple times.
OK so if it's already pasted in that's what this kind of says.
So if it's not pasted in right we'll actually paste it in there so that clears up like if you get if
we include this in many different files it would create would actually paste it in many different files
and you'll see some pretty wicked errors from the compiler if you don't do so.
Just follow this and you should be fine.
And in fact follow this for any kind of header file do.
It's quite useful and rude to actually right click again and say new source file and say you tills CTP
center and in here we're going to actually take these functions and are going to cut them from this
file.
And runty paste them in the Eutelsat CBP file.
Surgeons cut them from this and paste them right here.
And now we also need also the includes for this.
So first include we need is actually the utilized R.H. if you include utl Zych and you have to include
stream that so we can use CNC and correctly Stream.
And we're going to also include CC type for the two lower and Alpha ingress using namespace standard
like gets rid of all the errors.
So now that we don't have this in hangman anymore you will have some errors.
But to get rid of them here we're going to use a include tools to h
h.
And we should see that it still is for
in
O.
And there's one other thing we need is a more characters.
Of course
it's just that it's actually pretty inside of here.
This
structure in everything should work.
So that's one thing so.
So now why we've done this is now we can use this for multiple projects.
So you're going to include this utils agency BP into our next project so we don't have to always keep
kind of pasting in like this get character which don't need this anymore right way.
Get rid of that.
You don't need this get character
character function.
I would want to implement it every time.
Could just include these two files into our project and we'll have them pay off if they're right that
every time just nice.
So now that we've actually added the utilities H&R CVP there's one other thing I want to do.
Save that for the next lecture.