 Hey everybody, welcome back! Welcome back to C++ programming, I'm Rudio the Null, and in this tutorial, last time anyway, we were looking at comments, really, really simple things. It was like a one minute or less video, did not take much at all. But now, we're going to move on. I'm going to go ahead and create a new file. I'm going to save mine as 05inputs.cpp. And now you can see that exists in my folder. Okay, you know how to start a simple C++ program. It takes the pound symbol include, include iostream. We're going to use the namespace standard. Don't forget your semicolon I almost did there. And then we'll go ahead and create our integer function, our main function. Have our code block and we're good to go. Ready to program. Now, if we were to take inputs, let's think about this for a little bit. We know because of our iostream and because of the standard namespace, we can use cout to display text. I'll return 0 over here just so we don't forget. I think I keep doing that. It's not a big deal, but I mean it's good practice, so try to return 0 all the time you can. And yeah, let's actually just, let's go C++ to compile 05inputs. Now we've got our a.out and we can say, yeah, we can display text. Really, really easy with the cout or cout command with the operators sending the less than symbol. What if we wanted to take an input? Well, there's got to be some way we can do that. If we input something, obviously we might want to store what it is that we've inputted. We want to keep track of that. We want to know what they inputted after all. So we need a variable to keep track of that. I'll just say int. I'll just say int input. And I'm going to declare that. It's not being defined yet, but we want to use this variable. Now we can say, okay, cout, please enter a number. Actually, let's say integer. Please enter an integer. And I'm not going to include the new line there because I have this colon and it might just look a little, it might look well. It might look good. Okay. Now that we've got this done, now we actually need to input. We need to be able to grab what it is the user types into the program. We're using cout to actually display. So I guess by simple process of rationalization, we might be able to take a guess. And I obviously know this is true because in the standard namespace in the IO stream, we actually have something that we can use called cn. And that's rather than out, it's going in. And we're going to use a different direction operator. Rather than less than, we're going to use greater than. And we want to know where is that input actually going to? Well, in this case, it's going to input the variable that we created up here. So now once we've actually inputted that, it's going to wait once we hit the enter key. We can say, okay, it looks like you entered input. They're like, yeah, cool. You did that. Way to go. And just end the line there. Pretty simple. Pretty, pretty simple thing. But let's see if that'll work for us. I'll get over my terminal. Compile this. I'll actually, I'm going to use two n symbols in bash so I can just go ahead and run the code all in once. Please enter an integer. All right. 45. Looks like you entered 45. Awesome. That works just fine for us. All it's doing is it's using this cn kind of command or statement and c++ to grab the input that we enter. Actually, after we hit the enter key, it stores that into the variable that we've already defined, sorry, declared integer input where we know we're going to use that. And then it will display what we actually typed in. That's really cool. Now, of course, we can do more with this. What if we wanted to use the operator that we've had before? Let's say that number doubled is input times two because we know we have that multiplication operator. We were looking at operating data earlier, operating on data. Let's run this code. Compile and run. Please enter an integer. Let's go 20. Looks like, okay, the number you entered is 20. Sweet. And that number doubled is 40. Awesome. Of course, this is really, really simple and really, really easy, but I just want to show you what we've learned and how we can use that. We've got our input with our cn statement and operator, and we've got our multiplication operator to double the number that we've entered, to double our input. Simple stuff. That's all it takes. The cn statement, and that's how you get user input in C++. Thanks for watching, guys. Hope you're enjoying this, and I'll see you in the next tutorial.