// operating with variables
#include <iostream>
using namespace std;
int main ()
{
// declaring variables:
int a, b;
int result;
// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;
// print out the result:
cout << result;
// terminate the program:
return 0;
}
ouput : 4
#include <iostream>
using namespace std;
int main ()
{
// declaring variables:
int a, b;
int result;
// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;
// print out the result:
cout << result;
// terminate the program:
return 0;
}
ouput : 4
Learn More :
Operators
- Assignment operator (=) in C++
- Arithmetic operators ( +, -, , , % ) in C++
- Increase and decrease (++, --) operators in C++
- Relational and equality operators ( ==, !=, >, <, >=, <= ) in C++
- Logical operators ( !, &&, || ) in C++
- Conditional operator ( ? ) in C++
- Comma operator ( , ) in C++
- Bitwise Operators ( &, |, ^, ~, <<, >> )
- Precedence of Operators in C++