Lecture 13
Overloading Operator
Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main (int argc, char *argv[])
{
int a=4;
cout
<<" a value is :
"<< a << endl;
a*=2;
cout
<<" a value is :
"<< a << endl;
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 a=4;
cout
<<" a value is :
"<< a << endl;
a/=2;
cout
<<" a value is :
"<< a << endl;
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 a=4;
cout
<<" a value is :
"<< a << endl;
a%=2;
cout
<<" a value is :
"<< a << endl;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10