Skip to main content

Introduction to C++

Before you start

You will need programmer tools for code editing. Visit Development tools.

The First Program​

Once you have your editor ready, you can start writing your first program.

When learning a new programming language there is a tradition of starting with a program that writes "Hello, World!". Let’s do just that!

Create a project in your editor. A file called main.cpp

should have been created. If it wasn’t, create one and name it main.cpp

New files

If you don't know how to add a file to your project, see the tools section and find a tutorial for an editor of your choice.

We will save all our code in this file for now.

Application code​

Copy the following code into your editor, compile it and then run it:

main.cpp
#include <iostream>

int main()
{
std::cout << "Hello, World!";
}
Result (console)
Hello, World!

You should see an output like the one above.

You will find an explanation of the above code in the next lesson. πŸ™‚

Introduction to C++

Before you start

You will need programmer tools for code editing. Visit Development tools.

The First Program​

Once you have your editor ready, you can start writing your first program.

When learning a new programming language there is a tradition of starting with a program that writes "Hello, World!". Let’s do just that!

Create a project in your editor. A file called main.cpp

should have been created. If it wasn’t, create one and name it main.cpp

New files

If you don't know how to add a file to your project, see the tools section and find a tutorial for an editor of your choice.

We will save all our code in this file for now.

Application code​

Copy the following code into your editor, compile it and then run it:

main.cpp
#include <iostream>

int main()
{
std::cout << "Hello, World!";
}
Result (console)
Hello, World!

You should see an output like the one above.

You will find an explanation of the above code in the next lesson. πŸ™‚