Introduction: Basic C++

Picture of Basic C++

Today you will learn Basic C++ in 5 minutes.

Step 1: What You Will Need

Picture of What You Will Need

A Mac with terminal, or on any computer go to https://www.codechef.com/ide on any computer. And your imagination

Step 2: Only If You Are Starting in Terminal, Getting to the Editing Platform in Terminal

Picture of  Only If You Are Starting in Terminal, Getting to the Editing Platform in Terminal

The first thing you will need to do is make a folder on your desktop, call it anything you want, this is where your c++ projects will go.

Step 3: Getting to Your New Folder From Terminal, ONLY FOR PEOPLE WITH MACS

Now, you will need to open terminal and type in this, cd ~/Desktop/[Name of the folder] pwd

Step 4: Getting to Nano(fancy Word for Editing Software in Terminal), FOR MAC PEOPLE ONLY,

Congrats you are now in your folder on your desktop. now type in nano test1.cpp,

this will create a file named test1.cpp and bring you to the editing software for editing test1.cpp

Step 5: Putting Your Heading/ Starting Code In, FOR EVERYBODY,

Picture of Putting Your Heading/ Starting Code In, FOR EVERYBODY,

now that you have your nano up in terminal, and for those of you not on a mac, in codechef.com/ide. You have to insert a heading, in codechef, they already put in for you, but it is good to know and also nano does not start with it.

This is what you should put in,

#include <iostream>

using namespace std;

int main()

{

return 0;

}

, this is what will make your code run.

Step 6: Making Hello World

Now that we have our starting code, lets start the real program.

#include <iostream>
using namespace std;

int main()

{

//everything in the brackets is code, but when you put two slashes the code ignores that line insert the codebelowthis

cout << " Hello World" << endl;


return 0

}

Step 7: How to Run It

For those of you in codechef, press the run button in the bottom right. And the output should be Hello World. But for those of you in nano, type in the following:

do control o,

press enter,

do control x,

type in in the regular terminal not nano, type in make test1,

than type in ./test1

it should than run

Comments

learncppwithshay (author)2016-03-09

Your Welcome, If anybody would like me to make more c++ videos, please comment back. (It doesn't matter if it is a a year later, pls comment back)

What is a good book or a good way to learn more about C++ for a beginner?

I have read through some books and searched on line for information and let me say I have read through "hello world" many times. I would like to see something more complex and cooler that you can do with C++ and how to do it with great explanations of all the steps.

wold630 (author)2016-03-03

Thanks for breaking this down!

About This Instructable

980views

19favorites

License:

More by learncppwithshay:Basic C++
Add instructable to: