Console Out

4 minutes
Share the link to this page
Copied
  Completed
Learn how to output data/information to the console.

Transcript

Hello, welcome to the third tutorial in the c++ programming series. And today we're going to be looking at console out. By default, the standard a polo program points at the screen, okay, the terminal, so we can see our operator and the insertion operator, which is the less than less than symbol show you in a moment can print messages on to the screen. So obviously on x CO is the little command line in the bottom on Windows, there'll be the actual command prompt that pop. So we're developing on Expo, but it's literally the same code on Windows as well. So let's go ahead and open up our project.

The CFO console belongs to the standard namespace, which is the code is in here the input output stream. So we'll just delete this code for a second because that's what it was doing. So the standard namespace is STD. And then to access the slenderness if you do colon colon, then you really see a lot of functions here. What we want to do is to see our culture's part of the output strings where I put in text to the screen. So just click enter and then to actually write text or anything to do the less than less than one invoice some text is going to write Hello, world.

This is text and then you can either end it with a semicolon like that right there. We'll show you the result. And as you can see program and the exit code zero was on the exact same line a lot of time you don't want it to be on the exact same long wherever the next piece of text so what you can do is less than less than again, and you can do STD colon And knowing and if you run that that's basically print setting new line at the end which is pretty cool in here you can also just have a variable if you want to we'll be covering variables in the fifth tutorial when you put when you put the variable in you just literally put the name of the variable can also have multiple pieces attached to the runner and it's and it's working a okay anything it doesn't run right next to it so to know new line or note spacing don't have to literally put it next to it and you might find this alone annoying I do personally to do STD colon colon on or whatever the namespace name is.

So what you can do is a brittle using pain base. And then you put the name of the name basic STD, semi colon. And now before we're only formed STD colon, colon as well so old code won't be affected by this. But if you get rid of it, and then run it, go to that one still works. Okay, because we have just included the namespace here. We've used it at the top.

So that's pretty cool. Some people prefer to keep using namespace so if you're when you're going through college exactly was part of what namespace but it's personal preference. That's it for this tutorial. In the next tutorial, we're going to look at data types within c++. If you have any questions, feel free to message us or support us on our system called AK. I literally just had my finger on the entity, sir but that Yeah, well, yeah, feel free to message us at support our solar system Dakota, UK, the email will be in the description, and comment on this video directly messages via YouTube wherever you prefer what suits you.

Also all the required info source code will also be in the description. As usual. Thanks for watching. Hope you have a nice day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.