Parts of a loop
1. Initialization Expression.
2. Test Expression
3. Update Expressions
4. Body of the loop.
The for Loop
The for loop is a deterministic loop in the sense that the program knows inadvance how many times the loop is to be executed.
C++ provides statemets to perform efficiently and effectively. Such statements are called program control statements. These are selection statements ( if and switch), iteration statements (for, while and do-while) and jump statements such as (return, goto, exit(), break and continue)
Statements are instructions given to the computer to perform an action such as moving data, taking decisions or repeating actions. LEARN MORE>>
A C++ expression is a combination of operations, constants, and variables.
An expression is any statement which is composed of one or more operands and returns a value. It may be a combination of operators, variables and constants. the expression may be simple or complex.
Rules of formation of expression: LEARN MORE>>
When making complex expressions with several operands, we may have some doubts about which operand is evaluated first and which later. For example, in this expression:
a = 5 + 7 % 2 LEARN MORE >>
An operator is a symbol or letter which makes the compiler perform a specific operation on operands (variables) in a program.
An expression is a combination of operands ( i.e, constants, variables, numbers), and operators that perform a specific operation and parenthesis.
An expression is a sequence of operators that specifies a computation. an expression may result in a numerical value.
For example: x+y is an expression in which the sign + is an operator which specifies the addition operation. LEARN MORE >>
1. At the top of the program header files are declared.
2. A C++ prgram starts executing from main() function. The body of the main function is included with surly braces.
3. Each of the statment of the C++ program must end with a semicilon. a semicilon is also known as statement terminator.
So my first program would probably be:- LEARN MORE>>
In C++, input/output devices are treated as files; files are treated as a sequence or a stream of bytes. In other words, a stream in C++ means a flow of bytes from an input device to the CPU(input stream) and from the CPU to an output device (output stream).
Streams used for input and output are: LEARN MORE >>
Unary Operators: Unary operators require one operator to operate upon. The following are examples of unary operators.
& Address operator
* Indirection operator
+ Unary plus
- Unary minus
~ Bitwise operator
++ increment operator
-- decrement operator
! Logical NOT LEARN MORE>>
A C++ compiler always collects characters into the longest possible tokens, using white spaces to demarcate them. White spaces must be used to seperate an identifier, reserved word, integer constant, floating point constant from a following identifier, reserved word, integer constant or floating point constant and arithmetic or boolean operators. LEARN MORE>>
Data type is defined as the set of possible values a variable can hold. Data types in C++ can be divided into three categories:
- Built-in Data Type
- User Defined Data Type
- Derived Data Type
Built-in Data Types
The C++ compiler supports all the built-in data types. These data types are also known as standard data types and ae not composed of other data types. LEARN MORE>>
The Character set inC++ includes the following"
Source Code Character Set
A C++ compiler may use any character set that includes at least the following characters: LEARN MORE >>
C++ (C plus plus) is a general purpose programming language based on the C programming language. In addition to facilities provided by C, C++ provides classes, inline functions, operator overlaoding, constant type references, free store management operators, etc.
C++. Learn More