Operators Flashcards

(6 cards)

1
Q

State the 4 types of operators.

A
  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are logical operators?

A
  • && (AND)
  • || (OR)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to set decimal places and number of digits in my output?

A
  • # include < iomanip >
  • cout &laquo_space;statement block
  • &laquo_space;fixed &laquo_space;setprecision(no of decimal place)
  • &laquo_space;right &laquo_space;setw(number of digits)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly