course content

Course Content

Introduction to C++

First ProgramFirst Program

Traditionally, the first program we create is the "Hello World!" program:

cpp

main.cpp

The entire structure of the program is divided into several parts:

  • #include <> is a connection of libraries and auxiliary files. For example, the preprocessor directive #include <iostream> include the library named "iostream";
  • The function int main() { } – is the main (really? :) ) and required function in which the main flow of the program takes place. It's like one great stream of a river into which many other rivers flow;
  • namespace std; is the declaration from which space we will take the objects we used, namely cout and endl objects, taken from the standard space std, displayed the text "Hello World" on the screen;
  • // is the comment. The program itself ignores the comments. Comments are written only for people;
  • return 0; statement is the "Exit status" of the program. In simple terms, the program ends with this statement.

question-icon

What is the name of a mandatory function in the C++ language?

Select the correct answer

Section 1.

Chapter 2