
New
to myExercises:
New
to myNotes:
|
Order
this book today from

|
|
Title:
Microsoft Visual Basic 2005:
RELOADED, Second Edition
Author:
Diane Zak
Click
the image below to order your copy. |
|

|
|
|

| |
[ Up ] [ GUI Standards ] [ Access Files ] [ Accumulators, Counters & Averages ] [ Arrays ] [ Collections ] [ Constants & Enumerators ] [ Crystal Reports ] [ Data Types ] [ Flowchart Symbols ] [ Functions ] [ Keywords ] [ Methods ] [ Operators ] [ Repetition Structures ] [ Selection Structures ] [ Sub Procedures ] [ Toolbox Controls ] [ Variables ] [ Windows Forms ]
intro
Types
Comparison Operators
Logical Operators
Mathematical operators
purpose
truth table (precedence)
Is
TypeOf...Is
Like
You instruct the
computer to perform a calculation by writing an arithmetic expression that
contains one or more arithmetic operators.
|
Precedence
Order |
Mathematical
Operator |
Name |
Description |
| 1 |
^ |
Exponentiation |
Raises a number to a power, e.g 5^3
means 5 * 5 * 5 |
| 2 |
- |
Negation |
Is used to indicate a negative number, e.g -5 |
| 3 |
* , / |
Multiplication and Division |
The Division operator is used to divide
whole or decimal numbers and give a whole or decimal number answer |
| 4 |
\ |
Integer Division |
Is used to divide whole numbers and get a
whole number answer (no decimals) |
| 5 |
Mod |
Modulus Arithmetic |
Is used for
division, but it returns the remainder of the division. Standard
division and integer division tells you how many times a number will fit
into another number, e.g.
2004
/ 4 = 501
2004
Mod 4 = 0 |
| 6 |
+ , - |
Addition and Subtraction |
|
Tips:
| * |
Calculations are performed in the order
specified by the operator's precedence, however |
| * |
you can use parentheses ( ) to override the
order of precedence |
| * |
Operators that share precedence will be
dealt with from left to right |
| * |
The integer division operator is used to
divide whole numbers and get a whole number answer |
| * |
The division operator is used to divide
whole or decimal numbers and get a decimal number answer |
| * |
The modulus (Mod) operator is used for
division, but returns the remainder of the division, whereas standard
division and integer division tells you how many times a number will fit
into another number. |
| * |
The modulus operator is useful to calculate
leap years. |
Examples:
Calculations are
performed in the order that is specified by the operator's precedence, e.g. 5
- 2 * 7 + 2 will be calculated as:
2 *
7 = 14
14
- 5 = 11
11
+ 2 = 13
Operators that share
precedence will be calculated from left to right:
5 + 3 - 7 + 2 - 3
-------------------->
You can override
precedence by using parentheses. Whatever lies within the parentheses will
be calculated first, e.g
(5 - 2) * (7 + 2):
5 -
2 = 3
7 +
2 = 9
3 *
9 = 27
How to remember the
difference between the division operator ( / ) and the integer division operator
( \ ):
Let's
use the value 123.45
/ The division operator leans over
toward the decimals, which mean that decimals are included
\ The integer division operator leans
toward the whole numbers, meaning that decimals are exluded
|