CPP

109
3464 reads

February 1, 2012

Increase


Increase and decrease (++, --)
Shortening even more some expressions, the increase operator (++) and the decrease operator (--) increase or reduce by one the value stored in a variable.

89
3255 reads

February 1, 2012

Compound assignment


Compound assignment (+=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=)

When we want to modify the value of a variable by performing an operation on the value currently stored in that variable we can use co

115
2755 reads

February 1, 2012

Arithmetic operators


Arithmetic operators ( +, -, *, /, % )
The five arithmetical operations supported by the C++ language are:

+ addition
- subtraction
* multiplication
/ division
% modulo

110
3198 reads

February 1, 2012

Operators


Operators
Once we know of the existence of variables and constants, we can begin to operate with them. For that purpose, C++ integrates operators.

102
3704 reads

February 1, 2012

Defined constants (#define)


You can define your own names for constants that you use very often without having to resort to memory-consuming variables, simply by using the #define preprocessor directive. Its format is:

117
2039 reads

February 1, 2012

Literals


Literals
Literals are the most obvious kind of constants. They are used to express particular values within the source code of a program.

121
2765 reads

February 1, 2012

Introduction to strings1


As you may see in the previous example, strings can be initialized with any valid string literal just like numerical type variables can be initialized to any valid numerical literal.

109
2940 reads

February 1, 2012

Introduction to strings


Variables that can store non-numerical values that are longer than one single character are known as strings.

The C++ language library provides support for strings through the standard string class

137
3730 reads

February 1, 2012

Initialization of variables


When declaring a regular local variable, its value is by default undetermined. But you may want a variable to store a concrete value at the same moment that it is declared.

140
3638 reads

February 1, 2012

Declaration of variables


In order to use a variable in C++, we must first declare it specifying which data type we want it to be.