So this Mastery is really simple, you first need to get a good editor, I use atom, but there are plenty others to use Notepad ++ is one of them, but I highly recommend you to use atom, it seems more friendly.

So after you’re done getting your editor ready, open a new file and name it whatever you want. Make sure you save the new file right away and after you make any change.

So you should end up with this kind of code as shown below:Screen Shot 2015-09-17 at 11.10.43

You can also add some comment that won’t appear when you run the program in the terminal, it’s just a small note in the editor: you must write in using // at the end of the line where you want to add a comment. Something like this:

Screen Shot 2015-09-17 at 13.33.33as easy as this.

Once you’re done with this you might need to install an external terminal if you’re using window. In this case, since I’m programming in Mac, open the Terminal application will be enough.

Screen Shot 2015-09-17 at 13.22.45

So now you’ll need to change the directory. It’s easier if you save your files on the desktop or some simple inside folder or you’ll end up with a huge line of coding for the directory, but assuming you don’t you must use the cd command in order to access and choose the directory you want. In this case I’ll use cd desktop/c++

Screen Shot 2015-09-17 at 13.26.40 you should end up with something like this, if not, you could get a print that looks like this:

in this case just check if the line that you wrote before is right.

Now we proceed to select the program we want to compile the program we want to run using the following line:

Screen Shot 2015-09-17 at 13.30.47now we just need to run the program using ./a.out (if windows you might need to use ./a.exe)

and that’s it, you’re done with it.

Have fun printing random phrases in your screen.

CC BY 4.0 Masteries: 1) Ability to create C++ file and run from command line. 7) Use of comments in C++ . by Luis Daniel García is licensed under a Creative Commons Attribution 4.0 International License.