Get Started C++
You need the following two things to begin using C++:
- To write C++ code, use a text editor like Notepad.
- a compiler to convert the C++ code into a language that the computer can understand, such as GCC
C++ Install IDE
The code is edited AND compiled with the aid of an IDE (Integrated Development Environment).
Code::Blocks, Eclipse, Visual Studio, and dev C++ are examples of well-known IDEs. They can all be used to edit and debug C++ code and are all free.
Web-based IDEs can also be used, but their functionality is constrained.
In our tutorial, we’ll be using Dev C++ because we think it’s a good place to start. The most recent version of Dev C++ is available at goto: Dev-C++ download | SourceForge.net
Launching C++
Navigate to File > New > Source file in Dev C++.
Create the file myfirstprogram.cpp and add the following C++ code there (File > Save File as):
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
If you don’t understand the code above, don’t worry; we will go over it in more detail in later chapters. Focus on running the code for the time being.
In Dev C++, it should look like this:
To run (execute) the program, select Execute > Compile and Run. The end result will resemble this:
Congratulations! Your first C++ program has now been created and run.