## Lesson # 12. Recursive algorithms

Back Menu Theory Sample 1: Executing Recursive Factorial by Hand (without recursion) int factorial(int n) { if (n <= 0) { return 1; } return n * factorial(n — 1); }   int main() { int x = factorial(3); std::cout Читать далее

## Lesson # 8. Dynamic memory. Arrays of pointers.

Back Menu Go ahead Theory Function template A template variable is defined by declaring it before the beginning of a class or function: template <typename T> int max(T a, T b) { if (a > b) { return a; } Читать далее

## Lesson # 10. Classes

Back Menu Theory Classes are an expanded concept of data structures: like data structures, they can contain data members, but they can also contain functions as members. An object is an instantiation of a class. In terms of variables, a Читать далее

## Lesson # 11. Lists

Back Menu Go ahead Theory Forward_list or singly-linked lists Sequence Elements in sequence containers are ordered in a strict linear sequence. Individual elements are accessed by their position in this sequence. Linked list Each element keeps information on how to Читать далее

## Lesson # 9. Structures

Back Menu Go ahead Theory Structures in C++ A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Example: 1 2 3 4 Читать далее

## Lesson # 7. Pointer Basics

Back Menu Go ahead Theory 1. Pointer Basics Pointers are a way to specify the location of a variable. Instead of storing a value such as 5 or the c character, the pointer value is the location of another variable. Читать далее

## Lesson # 6. Using strings

Back Menu Go ahead Theory String type To work with a string the string library must be included: #include <string>#include <string> Variables of string type can be understood as an array of characters. A specific character in a string can Читать далее

## Lesson # 5. Arrays. Vectors

Back Menu Go ahead Theory Single-dimensional arrays The size of an array is fixed. Array elements are zero-indexed. The array does not store its size. sample 1: // Declaring an array of 5 int elements int b[5];// Declaring an array Читать далее

## Lesson # 4. Enumerations

Back Menu Go ahead Theory Enumerations The enum type declaration can be in the .cpp file at the top of the code (that is, outside of the functions), as well as in the header files. int main() { enum MyType Читать далее

## Lesson # 3. Arguments by Reference

Back Menu Go ahead Theory Note about for loop The for loop allows you to use several counters: the initialization and increment sections can contain several operators separated by the «,» (comma) operator int a = 0, b = 0; Читать далее