0:00 alright guys, welcome back to your fifth C plus plus tutorial and in this tutorial 0:04 since we now have the knowledge of variables 0:07 within c plus plus let's put that knowledge to use. So let's go ahead and 0:11 make three variables right now. 0:13 but, I'm gonna be making them a little bit different than before 0:16 So in last tutorial we had a variable like a 0:19 and we set it equal to the value like 54. simple enough 0:23 but I want to tell you guys that whenever you first create a variable 0:28 you have the option of assigning the value then 0:31 or assigning the value later on such as a 0:34 equals 54 this is perfectly fine thing you can do this way 0:39 so whenever you first create a variable 0:42 and don't assign a value this is called declaring the variable. 0:46 declaring is just another name for creating the variable 0:49 so let's go ahead and create three variables and by the way I'm gonna be 0:53 making a basic computer program 0:55 where the user enters two numbers such as like to 0:58 in 3 and the computer is gonna add them together 1:01 and it's going to give an answer which would be five so 1:04 int a. I'm gonna have a variable called a and I am going to have another 1:08 variable called 1:09 b and what we're gonna be doing is we're calculating the sum. 1:13 or in other words when you add the two numbers together the answer 1:17 of that and storing it in a variable called sum. so we don't have any 1:21 values yet so that's why we can't fill 'em in. the users can be answering the values 1:25 for us 1:26 so the first thing we want to make in this program is just a little prompt on 1:30 screen to tell the user to enter number 1:32 and you do that using cout and we just write 1:35 "enter a number hoss" and then let's go ahead and write new line 1:41 and now we need a way for the user actually 1:45 to input information from the keyboard so 1:48 here's a neat little thing I can tell you. cout 1:51 took information from your computer and output it to the screen, 1:55 but anytime you want to take information from the computer, 1:59 excuse me, from the user and give it to the computer 2:02 you need to use c-i-n, so cout basically takes information 2:08 from the computer gives it to the user cin 2:11 takes information from the user in gives it to computer 2:14 so if you wrint c-i-n and and by the way if you take a test 2:18 this is technically called the InputStream object 2:21 and the little greater and greater than sign 2:24 is called the stream exaction, [pause] extraction operator 2:27 so you know make sure to fill that on your multiple choice if you're watching 2:31 this 2:32 in the C++ class or something so anyways you can see that this is 2:36 different from the cout for two reasons. First of all it's 2:38 cin. instead of cout and also 2:41 your arrows face the opposite way. that's because you're giving information 2:46 to the computer instead of the computer giving information to you 2:49 so now all we can do is we're gonna enter a number 2:53 and whatever number we enter, we need to give a place to store that 2:57 number 2:58 what we already have a variable right here so let's go ahead and use that 3:02 in use the variable a. so check this out its gonna allow us to enter 3:07 enter number and whatever number we enter it's gonna be stored in the 3:11 variable 3:12 a. so for example if we entered the number three 3:15 a is going to be equal to 3. simple enough so now that we have that variable 3:20 taken care of we basically 3:22 need to do the same thing again with other variable be 3:25 so see out will say 3:29 answer another number and 3:33 just go ahead and which make a new line to make the program easier to read 3:36 and use that CNN but now an answer number we want that 3:42 value to be equal to the variable be so they're gonna answer to numbers 3:46 ones can be equal to A+ the others can be equal to be 3:49 son now for the summer we don't want them to 3:52 you know enter value for some we want to calculate their selves 3:56 so in order to do the edges go Henry some because 4:00 a plus be an hour 4:03 arc your programs can do is can say re: I'm gonna grab 4:06 vere excuse now I'm gonna grab the value put in for a 4:10 am gonna grab the value plan for be am going to calculate that 4:15 am gonna store that in the variable some so for example if you wrote 10 4:20 in 15 its gonna say are a crap 10 graph 15 4:24 calculate the sum a bit which is 25 story in a variable 4:28 called some so now the some 4:31 is equal to the answer and all we have to do now is pray now on screen so see 4:36 out 4:38 on which is straight some all those 4:41 numbers is is it the summer those numbers 4:45 are for some those numbers is I think it's is because it's one song 4:50 and again anytime you want to add more 4:53 than one line of text you could do it like this on you could hear a a new line 4:58 and then print this out on another line but I one at on the same I so I'm gonna 5:02 go ahead 5:03 and add another insertion operator just like that 5:06 and just go ahead and write some and then 5:09 at another one disco Henry en ligne to sharper and looks nice in name 5:14 so basically well let me go ahead and run this out I kester after a run 5:19 are computer program says answer number Haas I'm gonna answer 5:24 50 and then go ahead and press Enter once I press enter 5:27 50 is gonna be stored in the variable a 5:30 says enter another number I'm can enter 32 5:34 then I'm gonna press answer and that 32 is gonna be stored in the variable be 5:38 and its can make our calculation and pronounce cream 5:41 the summer those numbers is 82 50 5:44 plus 32 is indeed 82 sir member what we did 5:48 is basically this we made three variables that were gon be 5:52 using later on the first thing he said is just basically a prompt 5:57 answer a number then we entered 50 6:00 its toward fifty in the variable a using c& 6:04 again CNN is a way that the user can give information to the computer program 6:08 said the other way around so now a is equal to 50 6:13 you gave us another prompt and we typed in 32 6:16 now be is equal to 32 sonar to calculate the sum we took the some variable 6:21 and said equal to the some a fifty 6:24 post 32 some now some 6:27 holds the value I've 82 or 83 whatever i text and I can remember 6:32 and then all we did is we printed a row on the screen and again 6:35 we could've row three different statements for this one Cl 6:39 for this 1c out for this 1c after this 6:43 by in order to save us some time we can actually use this operator here 6:47 and pray everything out on one line so that is why our program ran the weighted 6:51 again 6:52 it's a go ahead and run it one more time answer number 44 6:56 and 76 to enter the summer those numbers is 120 7:01 pretty cool are so that's how you build a basic calculator in C pas plus 7:06 using variables and CL 7:09 so now that you got that done on we can begin moving on to the next topic which 7:13 is 7:14 I don't know but trust me it's going to be amazing so 7:17 arm you study this and want to understand the basics variables 7:21 and CN you're ready to move on to next video so for now 7:24 think ass rushing to you subscribe to now see in the next door