Lecture 21
Overloading Operator
Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main (int argc, char *argv[])
{
int num1=0;
cout <<"
num value : "<<num1;
cout
<<"\n Beginning of the num value :
"<<++num1;
cout
<<"\n num value :
"<<num1;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10
Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main (int argc, char *argv[])
{
int num1=2;
cout <<"
num value : "<<num1;
cout
<<"\n Beginning of the num value :
"<<--num1;
cout
<<"\n num value :
"<<num1;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10