Professional Documents
Culture Documents
Increment Operator:
The operator that is used to add 1 (one) to the value of a variable is called increment operator. It is used to add 1 (one) to the value of an integer variable. This operator can be used before or after the variable name. To add 1 (one) to a value of variable Total, increment operator can be written either before or after the variable.
#include<iostream.h> #include<conio.h> Void main(void) { Clrscr(); Int a=10; Cout<<a<<endl; Cout<<a++<<endl; Cout<<a<<endl; Getche(); }
For Example:
#include<iostream.h> #include<conio.h> Void main(void) { Clrscr(); Int a=10; Cout<<a<<endl; Cout<<a--<<endl; Cout<<a<<endl; Getche(); }