1. Introduction

Programming needs new universal algorithmic models, and hardware implements algorithms not only in a different form, but also on the basis of another algorithmic model - automaton. Borrowing technology from hardware development is the key idea behind automatic programming. However, the synthesis digital devices different from programming. But, borrowing the model, on the one hand, it is not desirable to significantly change it, and, on the other hand, it is impossible not to take into account the already existing theory and practice of programming.

Next, we will consider the SWITCH technology for designing automatic programs, in which you encounter similar processes all the time. On the one hand, she changed the model so much state machine, which actually took it beyond the scope of automata theory. And, on the other hand, it introduces into programming concepts that are hardly perceived by programmers, and, at times, are simply superfluous, because there are more familiar analogues from the theory of programs and the practice of programming.

As a basis for discussing the problems of automatic programming, we take a recent lecture by Shalyto A.A. and his "software" papers to the definition of the automata programming paradigm.

C++ (pronounced c-plus-plus) is a compiled, statically typed, general-purpose programming language that can be used to create programs of any level of complexity.
For more than 20 years, this language has been in the top three most popular and in-demand programming languages. (This can be verified by visiting the TIOBE website).
The language originated in the early 1980s, when Bell Labs employee Björn Stroustrup came up with a number of improvements to the C language for his own needs.

Bjarne Stroustrup - creator of the C++ language

Stroustrup decided to extend the C language with the features available in the Simula language. The C language, being the base language of the UNIX system on which the Bell computers ran, is fast, feature rich, and portable. Stroustrup added to it the ability to work with classes and objects. As a result, practical modeling problems turned out to be accessible both in terms of development time (due to the use of Simula-like classes) and in terms of computation time (due to the speed of C).
Here is how the developer of the language himself says it:



In 1998, the first language standard, known as C++98, was published by a standards committee. C++ continues to evolve to meet modern requirements. One of the groups that develops the C++ language and sends suggestions to the C++ standardization committee to improve it is Boost, which deals, among other things, with improving the capabilities of the language by adding metaprogramming features to it. The latest standard was released in 2017 and is called C++17. The next standard will not be long in coming and is expected to appear in 2020.
No one owns the rights to the C++ language, it is free. In March 2016, Russia established working group WG21 C++. The group was organized to collect proposals for the C++ standard, submit them to the committee, and defend them at general meetings of the International Organization for Standardization.
C++ is a multi-paradigm language (from the word paradigm - writing style computer programs), which includes a wide range of different programming styles and technologies. It is often referred to as an object-oriented language, but, strictly speaking, this is not the case. In the process of work, the developer gets absolute freedom in choosing tools so that the problem solved using one or another approach is solved as efficiently as possible. In other words, C++ does not force the programmer to adhere to only one style of program development (for example, object-oriented).
C++ has a rich standard library that includes common containers and algorithms, I/O, regular expressions, multithreading support and other features. C++ has influenced many programming languages, including: Java, C#, D. Since C++ belongs to a family of languages ​​based on the syntax of the C language, other programming languages ​​​​of this family can be easily mastered: JavaScript, PHP, Perl, Objective-C and many more. . etc., including the parent language itself - C. ()
During its existence, stable myths have been entrenched in the C ++ language, which are easily refuted (see here: Part 1 and Part 2)

The history of the language and the release of standards

1983

Language creator - Bjorn Stroustrup, at Bell Labs, introduced an early version of C++ (“C with Classes”)

1985

First commercial release of C++, language takes on modern name

1986

Release of the first edition of The C++ Programming Language, a C++ book written by Bjorn Stroustrup

1998

The international C++ language standard was ratified: ISO/IEC 14882:1998 "Standard for the C++ Programming Language"

2003
2005

Library Technical Report 1 (TR1) released. While not officially part of the standard, the report described extensions to the standard library that should be included in next version C++ language

2011

Release of a new standard - C++11 or ISO/IEC 14882:2011; new standard included additions to the core of the language and an extension to the standard library, including much of TR1

2014

Release of the C++14 standard (“International Standard ISO/IEC 14882:2014(E) Programming Language C++”); C++14 can be seen as a small extension of C++11, containing mostly bug fixes and minor improvements.

2017

The release of the new standard is C++1z (C++17). This standard has made many changes and additions. For example, STD included C11 standard libraries, file system, based on boost::filesystem, a large part of the experimental TS I library.

2020

C++20 is the informal name for the ISO/IEC standard for the C++ programming language, which is expected after C++17. Draft of the N4800 standard.

Philosophy C++

In The Design and Evolution of C++ (2007), Bjorn Stroustrup describes the principles he followed when designing C++ (given in abbreviated form):

  • Get a universal language with static data types, the efficiency and portability of C.
  • Directly and comprehensively support a variety of programming styles.
  • Give the programmer freedom of choice, even if it gives him the opportunity to choose incorrectly.
  • Keep compatibility with C as much as possible, thereby making it possible to easily switch from programming to C.
  • Avoid inconsistencies between C and C++: any construct that is valid in both languages ​​must mean the same thing in each of them and lead to the same program behavior.
  • Avoid features that are platform dependent or not universal.
  • "Don't pay for what you don't use" - No language feature should cause performance degradation for programs that don't use it.
  • Do not require too complicated programming environment.

C and C++

The C++ syntax is inherited from the C language. Although, formally, one of the principles of C++ remains to maintain compatibility with the C language, in fact, the standardization groups of these languages ​​​​do not interact, and the changes they make not only do not correlate, but often fundamentally contradict each other ideologically. So, the elements that the new C standards add to the kernel are elements of the standard library in the C ++ standard and are generally absent in the kernel, for example, dynamic arrays, arrays with fixed boundaries, parallel processing facilities. Stroustrup believes that combining the development of these two languages ​​would be of great benefit, but it is hardly possible for political reasons. So practical compatibility between C and C++ will gradually be lost.
AT this example, depending on the compiler used, either "C++" or "C" will be output:

Program 9.1

#include int main() ( printf("%s\n", (sizeof("a") == sizeof(char)) ? "C++" : "C"); return 0; )

This is due to the fact that character constants in C are of type int , and in C++ they are of type char , but the sizes of these types differ.

Application life cycle models

Life cycle software is the period of time that begins from the moment a decision is made on the need to create software product and ends at the moment of its complete withdrawal from operation. This cycle is the process of building and developing software (SW). There are several models life cycle.
Cascade model life cycle (English waterfall model) was proposed in 1970 by Winston Royce. It provides for the sequential implementation of all stages of the project in a strictly fixed order. The transition to the next stage means the complete completion of the work at the previous stage. The requirements defined at the requirements generation stage are strictly documented in the form terms of reference and are fixed for the duration of the project. Each stage ends with the release complete set sufficient documentation so that development can be continued by another development team.
Project stages according to the waterfall model:

  1. Formation of requirements;
  2. Design;
  3. Implementation;
  4. Testing;
  5. implementation;
  6. Operation and maintenance.

In the waterfall model, the transition from one project phase to another assumes the complete correctness of the result of the previous phase. In large projects, this is almost impossible to achieve. Therefore, such a model is suitable only for the development of a small project. (W. Royce himself did not adhere to this model and used an iterative model).
Iterative model
An alternative to the waterfall model is the model of iterative and incremental development (IID), which received from T. Gilb in the 70s. the name of the evolutionary model. The IID model breaks down the life cycle of a project into a series of iterations, each of which resembles a "mini-project", including all development processes applied to the creation of smaller pieces of functionality, compared to the project as a whole. The goal of each iteration is to obtain a working version of the software system, including the functionality defined by the integrated content of all previous and current iterations. The result of the final iteration contains all the required functionality of the product. Thus, with the completion of each iteration, the product receives an increment - an increment - to its capabilities, which, therefore, develop evolutionarily.


Various variants of the iterative approach are implemented in most modern development methodologies:

Development process - Rational Unified Process (RUP)

Rational Unified Process (RUP)(rational unified process) is a software development methodology maintained by Rational Software (IBM). The methodology provides recommendations for all stages of development: from business modeling to testing and commissioning of the finished program. The Unified Modeling Language (UML) is used as the modeling language.
The complete product development life cycle consists of four phases, each of which includes one or more iterations.

  • Initial stage (Inception)
  • Determining the scope of the project and the amount of required resources. The main requirements, restrictions and key functionality of the product are determined. The risks are assessed. Action planning. At the end of the inception phase, achievement of the Lifecycle Objective Milestone is assessed, which implies an agreement between the stakeholders to continue the project.

  • Elaboration
  • Requirements documentation. Design, implementation and testing of the executable architecture. Specification of terms and cost. Reduction of the main risks. Successful completion of the development phase means reaching the Lifecycle Architecture Milestone.

  • Construction
  • In the "Build" phase, most of the functionality of the product is implemented: the design of the application is completed, source written. The Build phase ends with the first external release of the system and the Initial Operational Capability milestone.

  • Implementation (Transition)
  • In the "Implementation" phase, the final version of the product is created and transferred from the developer to the customer. This includes a beta testing program, user education, and product quality assurance. In case the quality does not meet the expectations of the users or the criteria set in the Start phase, the Implementation phase is repeated again. Meeting all goals means reaching the milestone of the finished product (Product Release) and completing the full development cycle.



« Information technology. System and software engineering. Life cycle processes software tools» . This standard has been adopted by the Federal Agency for Technical Regulation and Metrology of the Russian Federation and is similar to the international standard ISO/IEC 12207:2008. This standard, establishes a general framework for the software life cycle processes that can be used as guidance in the software industry. The standard does not offer specific model life cycle. Its provisions are common to any life cycle models, methods and technologies for creating software. It describes the structure of life cycle processes without specifying how to implement or perform the activities and tasks included in these processes.

Presentation for the lesson
Message topics
  • Free Software Foundation (FSF)
  • Free software licenses
  • Free Software and Open Source
  • History of the development of programming languages
  • History of C. C and C++
  • Story
  • Criticism of C++
  • History of UNIX
  • Spiral Software Life Cycle Model
  • UML (English Unified Modeling Language - unified modeling language)
  • Microsoft Solutions Framework
  • IDE for C/C++ programming on Windows
  • C/C++ compilers
  • Creating a Console Application on Windows
Questions
  1. Why is the waterfall software development model not used in large projects?
  2. What is the difference between waterfall and iterative development models?
  3. List the stages of software development in the Rational Unified Process (RUP) methodology

Learning the basics and subtleties of the C++ programming language. Tutorial with practical tasks and tests. Do you want to learn how to program? Then you are at the right place - here free education programming. Whether you have experience or not, these programming lessons will help you get started creating, compiling and debugging C++ programs in different development environments: visual studio, Code::Blocks, Xcode or Eclipse.

Lots of examples and detailed explanations. Perfect for both beginners (dummies) and more advanced. Everything is explained from scratch to the smallest detail. These lessons (200+) will give you a good base / foundation in understanding programming not only in C ++, but also in other programming languages. And it's absolutely free!

It also covers step-by-step creation of a game in C ++, the SFML graphics library and more than 50 tasks to test your skills and knowledge in C ++. An added bonus is .

For repost +20 to karma and my gratitude!

Chapter number 0. Introduction. Beginning of work

Chapter number 1. Basics of C++

Chapter number 2. Variables and Basic Data Types in C++

Chapter number 3. Operators in C++

Chapter number 4. Scope and Other Types of Variables in C++

Chapter number 5. The order in which code is executed in a program. Loops, branches in C++

The C/C++ Standard Library includes a number of functions for reading and writing to the console (keyboard and monitor). These functions read and write data as a simple stream of characters.

The concept of a stream (stream), used in programming, is closely related to the usual, everyday understanding of this word. The input stream can be compared with a pipe through which water (information) enters the pool (computer memory), the output stream - with a pipe through which water leaves the pool. An important feature of this pipe is that data can only move in one direction at a time. Even if the same pipe is used for inlet and outlet, it cannot happen at the same time: to switch the direction of the flow, you need to stop it, perform some action, and only then direct the flow in the opposite direction. Another feature of the stream is that it almost never dries up. Sometimes it dries up, but this period cannot be long if the system is functioning normally.

printf() standard output function

The printf() function is a standard output function. With this function, you can display a character string, a number, a variable value on the monitor screen ...

The printf() function has a prototype in the stdio.h file
int printf(char *control string, ...);

If successful, the printf() function returns the number of characters printed.

The control string contains two types of information: characters that are directly displayed on the screen, and format specifiers that determine how to output the arguments.

The printf() function is a formatted output function. This means that in the function parameters it is necessary to specify the format of the data to be output. The data format is specified by format specifiers. The format specifier begins with a % followed by a format code.

Format specifiers:

%With symbol
%d integer decimal number
%i integer decimal number
%e decimal number in the form x.xx e+xx
%E decimal number in the form x.xx E+xx
%f
%F decimal floating point xx.xxxx
%g %f or %e whichever is shorter
%G %F or %E whichever is shorter
%o octal number
%s character string
%u unsigned decimal number
%x hexadecimal number
%X hexadecimal number
%% symbol %
%p pointer
%n pointer

In addition, the l and h modifiers can be applied to format commands.

%ld print long int
%hu print short unsigned
%Lf print long double

In the format specifier, after the % symbol, the precision (the number of digits after the decimal point) can be specified. The precision is set as follows: %.n<код формата>. Where n is the number of digits after the decimal point, and<код формата>- one of the codes above.

For example, if we have a variable x=10.3563 of type float and we want to display its value with an accuracy of 3 decimal places, then we should write:

printf("Variable x = %.3f",x);

Result:
Variable x = 10.356

You can also specify the minimum width of the margin to be printed. If the string or number is greater than the specified field width, then the string or number is printed in full.

For example, if you write:

printf("%5d",20);

then the result will be:
20

Note that the number 20 was not printed from the very beginning of the line. If you want the unused places of the field to be filled with zeros, then you need to put the character 0 in front of the field width.

For example:

printf("%05d",20);

Result:
00020

In addition to data format specifiers, the control string can contain control characters:

\b BS, bottomhole
\f New page, page translation
\n New line, line feed
\r Carriage return
\t Horizontal tab
\v Vertical tab
\" double quote
\" Apostrophe
\\ Backslash
\0 Null character, null byte
\a Signal
\N Octal constant
\xN Hexadecimal constant
\? Question mark

Most often you will use the \n character. With this control character you will be able to jump to a new line. Look at the examples of programs and you will understand everything.

Program examples.

/* Example 1 */
#include

void main(void)
{
int a,b,c; // Ad variables a,b,c
a=5;
b=6;
c=9;
printf("a=%d, b=%d, c=%d",a,b,c);
}

The result of the program:
a=5, b=6, c=9

/* Example 2 */
#include

void main(void)
{
float x,y,z;

X=10.5;
y=130.67;
z=54;

Printf("Object coordinates: x:%.2f, y:%.2f, z:%.2f", x, y, z);
}

The result of the program:
Object coordinates: x:10.50, y:130.67, z:54.00

/* Example 3 */
#include

void main()
{
intx;

X=5;
printf("x=%d", x*2);
}

The result of the program:
x=10

/* Example 4 */
#include

void main(void)
{
printf("\"Text in quotes\"");
printf("\nOxygen content: 100%%");
}

The result of the program:
"Text in quotation marks"
Oxygen content: 100%

/* Example 5 */
#include

void main(void)
{
int a;

A=11; // 11 in decimal equals b in hex
printf("a-dec=%d, a-hex=%X",a,a);
}

The result of the program:
a-dec=11, a-hex=b

/* Example 6 */
#include

void main(void)
{
char ch1,ch2,ch3;

Ch1="A";
ch2="B";
ch3="C";

Printf("%c%c%c",ch1,ch2,ch3);
}

The result of the program:
ABC

/* Example 7 */
#include

void main(void)
{
char *str="My string.";

Printf("This is %s",str);
}

The result of the program:
This is my line.

/* Example 8 */
#include

void main(void)
{
printf("Hello!\n"); // After printing, there will be a new line - \n
printf("My name is Paul."); // This will be printed on a new line
}

The result of the program:
Hello!
My name is Pavel.

scanf() standard input function

The scanf() function is a formatted input function. With it, you can enter data from the standard input device (keyboard). Inputs can be integers, floating point numbers, characters, strings, and pointers.

The scanf() function has the following prototype in stdio.h:
int scanf(char *control string);

The function returns the number of variables that have been assigned a value.

The control string contains three kinds of characters: format specifiers, spaces, and other characters. Format specifiers begin with the % character.

Format specifiers:

When entering a string using the scanf() function (format specifier %s), the string is entered up to the first space!! those. if you enter the string "Hello world!" using the scanf() function


scanf("%s",str);

then after entering the resulting string, which will be stored in the str array, will consist of one word "Hello". FUNCTION ENTERS A STRING UP TO THE FIRST SPACE! If you want to enter strings with spaces, then use the function

char *gets(char *buf);

With the gets() function, you can enter full strings. The gets() function reads characters from the keyboard until a character appears newline(\n). The newline character itself appears when you press the enter key. The function returns a pointer to buf. buf - buffer (memory) for the input string.

Although gets() is out of the scope of this article, let's write an example program that allows you to enter a whole line from the keyboard and display it on the screen.

#include

void main(void)
{
charbuffer; // array (buffer) for the input string

Gets(buffer); // enter a string and press enter
printf("%s",buffer); // output the entered string to the screen
}

Another important note! To enter data using the scanf() function, you need to pass the addresses of variables as parameters, and not the variables themselves. To get the address of a variable, precede the variable name with & (ampersand). The & sign means taking the address.

What does address mean? I'll try to explain. In the program we have a variable. A variable stores its value in computer memory. So the address that we get with & is the address in the computer's memory where the value of the variable is stored.

Let's look at an example program that shows us how to use &

#include

void main(void)
{
intx;

Printf("Enter variable x:");
scanf("%d",&x);
printf("Variable x=%d",x);
}

Now let's get back to the control line of the scanf() function. Again:

int scanf(char *control string);

The space character in the control line instructs to skip one or more spaces in the input stream. In addition to a space, a tab or newline character can be accepted. A non-null character indicates to read and discard that character.

The separators between two input numbers are space, tab, or newline characters. The * after the % and before the format code (format specifier) ​​instructs to read data of the specified type, but not to assign that value.

For example:

scanf("%d%*c%d",&i,&j);

typing 50+20 will set i to 50, j to 20, and the + will be read and ignored.

The format command can specify the largest field width to be read.

For example:

scanf("%5s",str);

specifies to read the first 5 characters from the input stream. If you enter 1234567890ABC, the str array will contain only 12345, the rest of the characters will be ignored. Separators: space, tab and newline - when entering a character, they are treated like all other characters.

If any other characters are encountered in the control string, they are intended to determine and skip the corresponding character. 10plus20 character stream by operator

scanf("%dplus%d",&x,&y);

will assign x to 10, y to 20, and skip the plus characters because they occur on the control line.

One of the powerful features of the scanf() function is the ability to specify a scan set (scanset). The search set defines the set of characters against which characters read by scanf() will be compared. The scanf() function reads characters as long as they occur in the search set. Once the character that is entered is not found in the search set, the scanf() function moves on to the next format specifier. The search set is defined by a list of characters enclosed in square brackets. The opening parenthesis is preceded by a % sign. Let's look at this with an example.

#include

void main(void)
{
char str1, str2;
scanf("%%s", str1, str2);
printf("\n%s\n%s",str1,str2);
}
Let's enter a character set:
12345abcdefg456

On the screen, the program will display:
12345
abcdefg456

When specifying a search set, you can also use the hyphen character to specify spaces, as well as the maximum width of the input field.

scanf("%10", str1);

You can also define characters that are not in the search set. The first of these characters is preceded by a ^ sign. The character set distinguishes between lowercase and uppercase letters.

Let me remind you that when using the scanf () function, you need to pass the addresses of variables as parameters to it. Above code was written:

char str; // array for 80 characters
scanf("%s",str);

Note that str is not preceded by &. This is because str is an array, and the name of the array, str, is a pointer to the first element of the array. Therefore, the & sign is not put. We are already passing the address to the scanf() function. Well, simply put, str is the address in computer memory where the value of the first element of the array will be stored.

Program examples.

Example 1
This program displays the query "How old are you?:" and waits for input. If, for example, you enter the number 20, the program will display the string "You are 20 years old.". When we called the scanf() function, we prefixed the age variable with an &, because the scanf() function needs the addresses of the variables. The scanf() function will write the entered value according to specified address. In our case, the entered value 20 will be written to the address of the age variable.

/* Example 1 */

#include

void main(void)
{
int age;

Printf("\nHow old are you?:");
scanf("%d",&age);
printf("You are %d years old.", age);
}

Example 2
Calculator program. This calculator can only add numbers. If you enter 100+34, the program will return the result: 100+34=134.

/* Example 2 */

#include

void main(void)
{
int x, y;

Printf("\nCalculator:");
scanf("%d+%d", &x, &y);
printf("\n%d+%d=%d", x, y, x+y);
}

Example 3
This example shows how to set the read field width. In our example, the field width is five characters. If you enter a string with more characters, then all characters after the 5th will be discarded. Pay attention to the scanf() function call. The & sign does not precede the name of the array name because the name of the array name is the address of the first element of the array.

/* Example 3 */

#include

void main(void)
{
charname;

Printf("\nEnter your username (maximum 5 characters):");
scanf("%5s", name);
printf("\nYou entered %s", name);
}

Example 4
The last example in this article shows how you can use the lookup set. After starting the program, enter a number from 2 to 5.

/* Example 4 */

#include

void main(void)
{
charbal;

Printf("Your score is 2,3,4,5:");
scanf("%", &bal);
printf("\nScore %c", bal);
}

Computers are probably the most versatile tools humanity has at its disposal. They are able to perform incredible calculations, they allow you to store great amount information, completely in different parts of the planet, and at the same time it is easy to exchange it, regardless of location. Computers make things easier everyday tasks, and they allow you to automate many routine processes that would be very tedious and boring for a person to perform. There is so much that computers can do, but still, computers are not as intelligent as humans are. To automate even the simplest process, you need to tell the computer clearly and unambiguously what exactly it should do. Unfortunately, our language and computer language are completely different. Thus, there is a serious language barrier between a machine and a person, which must be somehow overcome, otherwise the computer will not understand us. And while computers do not understand us, they will not do anything on their own. As a means of communication between a person and a computer, a huge number of programming languages ​​have been invented. With the help of programming languages, we create programs and the computer already directly works with programs. Programs themselves are sets of instructions that a computer can understand and execute.

Program types

In order to communicate effectively with a computer, which is exactly what we want, there is a wide range of programming languages.

Depending on the type of project, there are many factors to consider when choosing a programming language. Here is a list of the most notable factors:

Compilation, interpretation and JIT compilation

The compilation process translates code written in a programming language into the native language of the target machine. The program that performs this process is called a compiler. Compiling can make code run fairly quickly, especially if the compiler is efficient at optimizing. But the fact is that the resulting code cannot work on various operating systems, and the compilation process takes some time, and the more code, the longer the compilation process. It is worth noting that when making any changes to the program code, it is necessary to compile it and only then run it.

Interpreted programming languages ​​are read by a program called an interpreter and executed by the same program. Interpreted programming languages ​​can run on different operating systems, like an interpreter, and do not even have long compilation times. But programs written in interpreted languages ​​tend to be much slower than equivalent, compiled programs.

And finally, the so-called on-the-fly compilation (or JIT compilation). Such languages ​​compile quickly when the program is run. Programs written in JIT languages, as a rule, are not optimized, thereby speeding up the compilation process and restoring the balance between performance and cross-platform.

High or low programming levels

Low-level languages ​​mostly work directly with the hardware and are therefore best suited for writing device drivers. Drivers are programs that control hardware and have direct access to it. However, a program written in a low-level language is usually difficult to port to other platforms. And therefore, for each OS, the same device comes with different drivers. Low-level programming languages ​​almost always compile.

In high-level languages, the focus is on the concept of the language. That is, such a programming language should be easy to understand, such as representing data as arrays, strings, objects, etc. A high-level language is usually easier to understand than a low-level language. And, as a rule, it is much easier and faster to develop a program in a high-level language than in a low-level language. As you can see different levels programming languages ​​are designed for completely different tasks, and it is not worth comparing the functionality of multi-level languages, it is meaningless.

Data type systems of programming languages

For every programming language, there is a specification that defines various rules that programming languages ​​must follow. Some languages ​​don't have data types, so this doesn't apply to them. However, most languages ​​(including C++) have data types, so this information will be useful to you.

Strong or Weak Data Type System

A weak input system does not put any restrictions, the programmer must follow this. Saying " weak system data" I mean that a language with such a data system does not strictly regulate the available data type casts. For example, if a string or character is passed to the multiplication function instead of a number, non-strongly typed programming languages ​​will execute such code, although the result of the multiplication loses all meaning, since a string cannot be multiplied by a number. Moreover, the result of performing this meaningless multiplication will be unpredictable. If the programming language is strongly typed, then at the compilation stage, the compiler will report an error and stop the process of building the project. For example,

// sample C++ program #include using namespace std; int main()( char string = "example"; int number = 5; cout<< string * number << endl; // умножаем строку на число }

As a result, the compiler will report an error:

error: invalid operands of types 'char ' and 'int' to binary 'operator*'

We will try to do the same in a non-strongly typed programming language - php. Note that even when declaring variables, the data type does not need to be specified.

The result of executing this code will be zero. No error will occur, although it would seem that it is impossible to multiply a string by a number. But in php everything is possible. The php language compiler will not report an error, the script will work and even give the result, and if our program consists of 1000 lines of code, then it will be difficult for us to find this error. This is a prime example of a programming language with a "weak data type system", that is, the prevention of such absurd operations rests entirely on the shoulders of the programmer.

Defined or undefined data type

This applies to both compiled and interpreted languages. Many languages ​​require explicit definition of the type of variables, so there is no uncertainty, the compiler and interpreter clearly know what to do. Some programming languages ​​do not require you to explicitly define the type of variables. The data type is determined automatically by the contents of the variable.

Static or dynamic data type

If the language is statically typed, then the compiler/interpreter does the type checking once before the compilation/interpretation process. If the data type is dynamic, then the data types are checked at run time.

Safe or unsafe data type system

There are situations that can lead to an unpredictable result or an error. A safe language will introduce as many restrictions as possible to ensure that such situations do not arise. While an unsafe language places all responsibility on the programmer.

These factors can characterize both one and several programming languages.

Supported programming paradigms

Programming paradigms are methodologies or ways of programming that a programming language supports. Here is a list of the main paradigms:

Declarative paradigm

A declarative programming language will focus more on the end rather than the means to that end. It is enough to indicate what needs to be achieved, it is not necessary to indicate what means to use. This paradigm prevents unwanted side effects that can occur when writing your own code.

Functional paradigm

Functional programming is a subset of declarative programming that attempts to solve problems in terms of mathematical equations and functions. Functional programming treats variables and objects as data that is not shared, unlike imperative languages.

Generalized paradigm

Generic programming focuses on writing algorithms in terms of data types to be defined. That is, the same algorithm can work with different types of data. This approach can be a very powerful tool, but only if it is well implemented.

imperative paradigm

Imperative languages ​​allow programmers to give the computer an ordered list of instructions that are needed to complete a task. Imperative programming languages ​​are opposed to declarative programming languages.

Structural paradigm

Structural programming languages ​​are aimed at providing some form of code - a hierarchical structure. When the structure of the code is clearly visible, the order in which the statements are executed becomes intuitive. Such languages ​​usually frown on "jumping" from one piece of code to another, such as the well-known goto operator that is defined in C and C++.

procedural paradigm

A procedural programming language refers to a structured programming language that supports the concept of a procedure or subroutine.

Object Oriented Paradigm

Object-oriented programming (sometimes abbreviated as OOP) is a subset of structured programming that expresses programs in terms of "objects". This paradigm allows code to be reused and is easy to understand.

Standardization

Do languages ​​have an official standard? Standardization is very important to ensure a conflict-free understanding of the program by different compilers / interpreters. Some languages ​​are standardized by the American National Standards Institute (ANSI), others are standardized by the International Organization for Standardization (ISO). All programming languages ​​must be standardized, otherwise it will not be possible to agree on what is right and what is wrong in syntax.

Let's characterize the C++ programming language

Now that we have looked at the main characteristics of programming languages, let's determine what factors the C++ programming language satisfies.

C++ is an ISO standardized programming language.

For some time, C++ did not have an official standard, however, since 1998, C++ has been standardized by the ISO committee.

C++ compiled language.

C++ compiles directly to machine code, making it one of the fastest languages ​​in the world.

C++ is a strongly typed language.

C++ implies that the programmer knows what he is doing and allows for an incredible amount of possibilities, limited only by the imagination.

C++ supports static and dynamic data types.

Thus, data type checking can be done at compile time or at run time. And this once again proves the flexibility of C ++.

C++ supports many paradigms.

C++ supports procedural, generic, and object-oriented programming paradigms, among many other paradigms.

C++ is a portable programming language.

As one of the most used languages ​​in the world, and as an open language, C++ has a wide range of compilers that run on a variety of platforms. C++ standard library code will work on many platforms.

C++ is fully compatible with the C language

In C++ you can use C libraries and they will work properly.