DEV Community

Manzura07
Manzura07

Posted on

C++ first lesson

Line 1: #include from which the library (#include) is called. The "iostream" library provides the ability to work with input and output objects.

line 2: using namespace std means we can use names for objects and variables from the standard library.

line 3: empty line discarded. C++ ignores whitespace.

line 4: Another thing that comes up all the time in a C++ program is int main(). This is called a function. What code inside curly braces {} is executed. The code inside the {} brackets is read as the first set of operators to be executed when the program starts.

line 5: cout (pronounced "to see") is an object used in conjunction with the input operator () to print the text /. In our example, "Hello world" will be output <<.

cout - added from combinations 'c' + 'out', i.e. extension "c" is C++ (programming language), "out" is "output".

; - count each operator in the C++ programming language; a semicolon is inserted.
//For example: cout <<"Hello World";

The body of the program could be written int main() function (don't forget that you can write in one line)

_ line 6_: return 0; terminates the main function.

line 7: } Don't forget to add a closing curly brace to actually end the main function.

Top comments (0)