Environment to write code
You need a text editor to write your code. To compile your code, you need a compiler which will convert your code to machine understandable language, which will then machine understand.
Compiler
A program that translates instructions written in a high-level language into the equivalent machine language For this purpose, we use Integrated Development Environment (IDE) which is used to edit and compile the code. There are different IDEs available like:
- Code Blocks
- Eclipse
- VS Code
- Dev C++
These are all free and you can use any of these to run your code.
Note: Web based IDEs can also work but their functionality is limited.
You can download VS Code from their official website.
After setting up the environment, open the new file. Write the following code and save it with the extension ".cpp"
Your code should be error free so that it will execute without any error. We will understand this code in the next chapter.
Practice Exercises
Complete these exercises to reinforce your learning and earn XP