DEV Community

Kerimova_Manzura
Kerimova_Manzura

Posted on

Functions in C++ language.

Hello, today I would like to tell you a little about the C++ language.

  1. what is C++? Answer: Games are written on it and neural networks are trained on it, thanks to it Google search and trading exchange robots work.
  2. Why do we need the C++ language? what is it for? Answer: C++ is used to create software of various kinds: from games to operating systems. 3.What is written in C++? Answer: Many famous applications were written in C++, including the Windows and OS X operating systems, many games such as World of Warcraft and Counter-Strike. Almost any software can be written in C++, from simple console utilities to complex applications.

Let's write our 1 code in C++
to begin with we write:
#include <iostream>
using namespace std;

Without these commands our code will not work.
what does this command mean?
good question)
The using namespace std; command in C++ allows you to use standard elements (functions, objects, classes) from the C++ standard library without explicitly specifying std:: before each name. This makes the code more readable and usable, but can lead to potential naming conflicts in large projects.
Afterwards we write
int main() {
cout << "Hello World!";
return 0;
}

the meaning of this code:

  1. int main() { ... }: This is the start of the main function, which is the entry point to the program.

  2. cout << "Hello World!";: cout is a standard output stream object in C++ that is used to output data. Using the << operator, the string "Hello World!" is printed. to standard output.

  3. return 0;: Returning the value 0 from the main function indicates successful completion of the program.

After we check the result, β€œHello World!” should appear.

Thank you for your attention!)

Top comments (0)