0:00 alrighty guys, welcome back to your 7th C++ and in this tutorial 0:05 as promised I'm coming be going over basic c plus plus 0:08 arithmetic. Now, I don't know. I think it was like two tutorials ago. 0:12 I give you guys a variable showed you guys that instead which is setting equal 0:17 to a plain old 0:18 value like this, you can use basic arithmetic like four 0:21 plus 6, and then when you go ahead and print it out, 0:25 X or anything like that, it actually calculated the value 0:29 in printed it out the answer. So, go ahead and run this 0:32 and you see the X now equals four plus six. 0:35 So, aside from addition I want to show you guys 0:39 all the arithmetic operators that you can use and they're a little bit different 0:42 than you might expect. So, let's are the easy ones first. 0:45 The first one is subtraction. And of course like eight minus four. 0:49 This would be valid. If you go ahead and build this, we saw that 0:52 the answer would be four. So, addition, subtraction easy enough. 0:56 But, also aside from addition and subtraction, you can use multiplication, 1:00 but make sure not to use x like that, because that'll mess up. 1:04 In order to multiply in computer programming use the asterisk. 1:08 That's the symbol above 8 (*) on your keyboard and what this is going to do is multiply 1:12 these two numbers, 1:13 eight times four, so now if you go ahead and run this we should get 32. 1:17 And check it out. 32 just like that. So, 1:21 the... well let's go ahead and before I go over this 1:24 let's go ahead and go over...uhm... division. 1:27 In order to use division in computer programming let's go ahead and take 1:31 81 divided by 3. Division, 1:35 the symbol for this is the forward slash. 1:38 So, let's go ahead and take a 81 divide by three and we get 1:42 27 just like that. Simple enough. But check this out. What if we have something 1:47 like 1:47 81 divided by two. Well, this I mean, 1:52 should be forty, but has a remainder 1. So, let's go ahead and try to build and run 1:56 this 1:57 and see we get. Well, it just says forty, that's 2:00 not entirely right, because it should have a remainder of one. So, 2:05 let's go ahead and to build and run this and see what we get. We're working with integers 2:08 and we don't know any other data type, so how can we get that remainder? 2:12 well whenever we want to use the remainder 2:15 we need to use something called the modulus operator. That is 2:19 the percent sign like this. What this is going to do 2:22 is is gonna give you the remainder at the answer it's not gonna say for the 2:26 remainder 1 2:27 it's just gonna give you that one so let's go ahead and build 2:30 in run this. And you can see that whenever we do 2:33 81 modulus two, its gonna give us the remainder 2:37 which is one. So, let me show you guys a better example are maybe 2:40 24 module seven. Well we know that 2:43 21, excuse me, 24 divided by seven is 2:47 3 with .... the remainder 3. 2:51 So, let's go ahead build and run this. And again it doesn't say 2:54 3 remainder 3. It just says the remainder which is three. 2:58 Simple enough. So now that we know all the arithmetic operators, 3:03 I can begin teaching you guys about order of precedence. 3:06 Now aside from just you know one number 3:10 arithmetic operator, another number, you can have 3:13 complex calculations like six times four plus 3:17 8 times 4 plus 3:20 9 divided by 20. And if we go ahead and build and run this 3:25 we see what we get: 56. You're saying alright. 3:28 So, what order is this doing this in? Is it doing 3:32 six times for and then plus 8, or is it doing you now 3:36 four plus 8 and times that by six, because 3:40 depending on how you do it its is gonna come out with a different result so 3:45 the basics is this if you remember way back in like 7th grade math 3:50 you know something called your associative property and that's pretty 3:54 much it 3:54 anything that's in parentheses gets done first 4:00 if you don't have any print sees because like this 4:04 it does of a multiplication in Division 4:07 which should be this this and this 4:11 it's going to do that first and then is going to your decision 4:14 addition and subtraction 4:17 if you don't have if you know if you just have liked for 4:21 plus a plus 7 on their centauri 4:25 than is again into a possum fur store for plus a first 4:28 it really doesn't matter comes at the same either way the only time you have 4:32 arm varying answers is when you have like 4:35 for plus 3 4:39 times seven for example if you did for place 3 4:43 lb7 time seven would be 49 4:47 but when I every run this 4:50 will easy box we at 25 why's that because he uses the associative property 4:55 actually multiplies for switches sometimes three and that's 21 4:59 plus for which is 25 so again 5:03 if you want to explicitly say four poster the first 5:06 you need to surround the in parentheses so now when everybody run this 5:10 its gonna run your practice his first and say re: four-plus 5:14 3 because seven time seven because forty-nine sir member 5:18 the rule is this parentheses first than your multiplication and division 5:23 and then your addition and subtraction so 5:27 remember their and if you get computers is called the associative property 5:31 should have learned in like eighth-grade matter night cream at I'm be some great 5:34 I don't know I can remember as a long time ago for now and that's all i wanna 5:38 talk to you guys about 5:40 basic arithmetic and how it works in C pas plus 5:43 so for now that's all you guys get something your ass Russian store 5:47 there any questions go to my our website the new boss in a comment click on Form 5:52 and you can ask me there so one last time inc.'s Russian company subscribe 5:56 now see you next video