and operator c++ code example
Example 1: c++ .* operator
The .* operator is used to dereference pointers to class members.
Example 2: and c++
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
if(a >= 20 && a <= 30){
cout<<"Il numero inserito è compreso tra 20 e 30";
}
else{
cout<<"Il numero inserito non è compreso tra 20 e 30";
}
}
Example 3: how does ++operator works in c++
#include <stdio.h>
int main() {
int var1 = 5, var2 = 5;
printf("%d\n", var1++);
printf("%d\n", ++var2);
return 0;
}
Example 4: operator c++
Common operators
assignment | increment | arithmetic | logical | comparison | member | other
| decrement | | | | access |
-----------------------------------------------------------------------------
a = b | ++a | +a | !a | a == b | a[b] | a(...)
a += b | --a | -a | a && b | a != b | *a | a, b
a -= b | a++ | a + b | a || b | a < b | &a | ? :
a *= b | a-- | a - b | | a > b | a->b |
a /= b | | a * b | | a <= b | a.b |
a %= b | | a / b | | a >= b | a->*b |
a &= b | | a % b | | a <=> b | a.*b |
a |= b | | ~a | | | |
a ^= b | | a & b | | | |
a <<= b | | a | b | | | |
a >>= b | | a ^ b | | | |
| | a << b | | | |
| | a >> b | | | |
Example 5: operand-- c++
++x;
x+=1;
x=x+1;