Okay, so in this next segment, we're gonna show you a C program. And this a C program that, if you like to play craps, which you can do legally in Las Vegas, this lets you properly compute the odds of getting various dice outcomes. So, we're gonna compute probability as C program then what we're gonna do is show you how to convert it to a C plus plus program, so this is your first hands on. Stuff that you're gonna actually gonna come away with. You're gonna already be a C++ programmer after this little lesson. And, again, I'm expecting everybody here to be a C programmer. So, among the things you should know are standard libraries. Any time a standard library has a function, that's the function we should use. That's what the community expectation is. I'm going to be talking a lot about community expectations. Good programmers fulfil community standards, community expectations. So, we need io, this is the io library. We need some basic functions, like the ramp and number function, that's gonna come in here. And we need some timing functions as well from the standard timing library. All of these commands are what are called pre processor commands. One of the things we're going to find out is that we We don't, don't want to use, We want to use the preprocessor less. And we're gonna explain why but for the moment, this should all be familiar. Here's your use of the rand number function, a dice has six sides, we have the little dice that we're rolling, it has pips on it between 1 and 6, and 2 dice give us outcomes between two and 12 not a great drawing of a dice but, in our main program we're going to do what i call because we are going to do a lot of this So, this program is prototypically a simulation. And With simulations, we want to do things that are random. We don't want the simulator to always be working in the same way. We don't want it deterministic. Well, there's a little contradiction there. A computer is a deterministic device. How do you get to simulate randomness? That's actually a deep theory. My neighbor, Don Knuth, down the road at Stanford, world authority on it, he wrote a whole book on seminumerical algorithms, talked at great length about writing code that looks random. So, there is a whole deep theory of randomness. We're not going to worry about. We just are taking some expert code, which is a random number generator and figuring that it, in effect, looks like what would otherwise be a true random process. One of the things we do Is we call on the system clock. And this seeds the random number generator. We don't want the program running the same way each time. It'd be like going to Las Vegas, starting on a slot machine, and always seeing the same outcomes. Casino doesn't want to see that so it has to have a mechanism for starting at a different point in the sequence each time. That mechanism is to call the seeding function, call a systems clock And the clock is going to be a readout that different pf times of the day that will have different numbers. So, it will start you at a different placent sequence. And then we are gonna run a whole bunch of trials, and I'm gonna leave this to you, you can run the code at home on C or C plus plus Are going to be stored in here. And these outcomes are going to be Dice 1 and Dice 2. So, if Dice 1 i is a five and Dice 2 is a six, you're going to get an outcome for getting an eleven. So, traditionally, when you first roll dice in craps, you get a seven or eleven, you win. If you wanted to know how many outcomes or the likelihood of getting seven and eleven, to know what the payoff should be for that, you can run this simulator and look at the outcomes for eleven, look at the outcomes for seven and get a sense of that probability. This is just gonna build that set of tables and then here it prints it out. What did we get in this seed program. We got standard libraries. We got macros. And we have this special symbol. That introduce the preprocessor commands and then we saw the special function main. While main is not a keyword, it is reserved for starting the program. We will always have a main function, that's where the program will start, that's where the thread for the program will start. And main, by the way, in C and C++, is int. And if it's otherwise not specified Implicitly return 0, so depending on your company's style guide, you may want to always have an explicit return 0, meaning your program terminates correctly and passes the 0 value back to the operating system. So, that's C.