Operators Flashcards
(6 cards)
1
Q
State the 4 types of operators.
A
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
2
Q
What are all the types and functions of arithmetic operators?
A
- “*” (Multiplication)
- / (Division) would give integer value of input is both int
- ”+” (Addition)
- ”-“ (Subtraction)
- “&” (Modulus) takes the remainder of result
3
Q
What are predefined math functions?
A
- The following pre-processor directive must be included in your program to direct the compiler to include the cmath header file. # include < cmath >
- pow (x,no.) – to raise a number to a power
- sqrt (x) – to compute the square root of a number
- sin – to compute the sine of an angle
- log – to compute the natural logarithm of a number.. etc
4
Q
What are logical operators?
A
- && (AND)
- || (OR)
5
Q
What are relational operators?
A
- > (greater than)
- > = ( greater or equal to )
- < (lesser than)
- <= (lesser or equal to)
- == (equal to)
- != (not equal)
- (+) / - / (/) / * = (e.g j*=2 => j = j * 2
6
Q
How to set decimal places and number of digits in my output?
A
- # include < iomanip >
- cout «_space;statement block
- «_space;fixed «_space;setprecision(no of decimal place)
- «_space;right «_space;setw(number of digits)