Preface/PREFACE
C++ is a mid-level language that was designed and developed at Bell Labs starting in 1979. C++ further expands and improves upon the C language and is an object-oriented programming language. C++ can run on multiple platforms, such as Windows, MAC operating systems, and various versions of UNIX.

Firstly
The first step in programming is to have an Integrated Development Environment (IDE), simply put, an application used for programming. This tutorial will use DEV C++ as the IDE. Incidentally, DEV C++ is also the designated application for C language competitions.
You can replace the endl in the code above with “\n”.
You can replace the endl in the code above with “\n”.
Secondly
To understand C++, due to the extensive content, I will briefly introduce some features of C++.
Object-Oriented Programming (OOP): When writing large programs, OOP provides a methodology. Unlike procedural programming, which emphasizes algorithms, OOP emphasizes data. OOP does not try to fit problems into the procedural approach of the language, but rather tries to make the language meet the requirements of the problem. The idea is to design data formats that correspond to the essence of the problem.
Finally
Starting with “Hello world”. First, in the DEV C++ window, go to the top left corner – New – BASIC – Create a Console Application. Due to space limitations, please refer to additional materials for details.
Input the following code (which will be explained later):
#include<iostream>
int main()
{
using namespace std;
cout<<“Hello World!”<<endl;
return 0;
}
Then compile and run, with the compile shortcut key F9 and run F11.
The first line of code can be temporarily ignored by beginners; just remember to include it every time you program. To satisfy the curiosity of the readers, here is a brief introduction: C++, like C, uses a preprocessor that processes the source file before the main compilation. Such preprocessors are all prefixed with #. This line of code causes the preprocessor to include the contents of the iostream file into the program.
If you have learned some C language, you might be surprised by the absence of the header file suffix .h; in fact, this is a new style in C++.
using namespace calls the namespace, and this line of code calls the std namespace. Simply put, calling std means you can use all functions under std. For example, if there are two companies A and B, each encapsulating a product that contains a function called wanda(), the question arises: how do we distinguish which one is A and which one is B? This is where namespaces come into play; in fact, A’s wanda() function is fully qualified as A::wanda() and B’s as B::wanda(). By calling the namespace, we simplify the function call by omitting the prefix, making the program more organized.
cout<<“Hello World!”<<endl;
The text within the double quotes is the information output (printed) on the screen, which is called a string in C++. << sends this string signal to cout, which executes the printing (you can think of cout as capable of outputting characters).
<<endl is called a control character, which moves the cursor to the beginning of the next line, hence we say it performs a line break. Similarly, << sends the line break information to cout, executing the line break operation.
For example, if we write this code (demonstration, omitting the beginning and end):
cout<<“An apple a”;
cout<<“day,”<<endl;
cout<<“keep a doctor away”;
The output result is as follows:
An apple aday,
keep a doctor away


*Statement:This article is compiled from the internet, and the copyright belongs to the original author. If there is any incorrect source information or infringement of rights, please contact us for deletion or authorization matters.