The C++ programming language

T

In the early 70’s appeared the C-language, developed by Dennis Ritchie and Brain Kernighan. The C ++ language is the creation of Bjarne Stroustrup and is an extension of the C language that allows programming on objects.

Creating a C ++ written program requires four steps:
1. editing-writing the source program by creating a file with the cpp extension;
2. compile-it returns to the internal memory the source program, checks for errors and converts this program into object program, having the scope extension;
3. link-editing – links the object program to the system libraries and turns into an executable program with the exe extension;
4. Execution – the object program is executed: the data is read, the calculations and the results are written, forming the file.

The general structure of a C ++ program
1. A C ++ program consists of a sequence of modules, called functions
2. One of these functions is the main function called main ()
3. main () is a special feature that must necessarily occur once in any C ++ program
4. The execution of any program starts with the main ()
5. a function is made up of the header and the body
6. The function header contains the name of the function, the type of the result obtained by the function calculates the function and a list of parameters by which the function communicates with its exterior, enclosed in round brackets
7. The body of the function contains statements and instructions specifying the processing of that function

The form of the main function
int main () {…. return 0;
The return statement is used to end the execution of a function and return the expression value specified in the return statement as the value of the function.

Language elements
C ++ is characterized by:
1. syntax – consists of all the correct writing rules of programs;
2. semantics – represents the meaning of syntactically correct constructions;
3. vocabulary – consists of all the words that can be used in a program.

The vocabulary of the C ++ language is composed of:
1. the character set
2. identifiers
3. keywords
4. separators
5. comments

a. The character set
The character set used for writing C ++ programs is the character set of the ASCII code

The ASCII code consists of:
-the large and small lattices of the Latin alphabet (A-Z, a-z);
– the digits of the decimal numbering system (0-9);
-the special characters (blank, +, *,%, =, {,!, #, etc.).

b. Identifiers
Identifiers (names) have the role of naming program elements such as constants, variables, functions, etc

c. Keywords (reserved)
Keywords are words that have a well-defined meaning and can not be used in any other context.
d. Comments
For a program to be easy to understand, comments are used. These are texts that will be ignored by the compiler but are intended to explain to the programmer certain program sequences

e. Separators
Separators are used to delimit syntactic units.
Types of separators:
-blank
-Table
– the CR + LF control characters generated by the Enter key
– Command

Simple types of data (standard)
By data, it is generally understood everything that is processed by a computer. Each data has a certain type.
A data type defines:
-the amount of values ​​that data of that type can take;
-the mode of their representation in memory;
-operations that can be performed with the data.

Classification of data types:
-defined data types-associated with a keyword used in the statement;
-type data types defined by the user.

Recent Posts

Archives

Categories