Lecture 23
Overloading Operator
Code:
#include
<iostream>
#include
<conio.h>
using
namespace std;
int main (int
argc, char *argv[])
{
int num1=6;
cout <<" num value : "<<num1;
num1=num1*1;
cout <<"\n One multiple value
: "<<num1;
cout <<"\n Two multiple value
: "<<num1*2;
cout <<"\n Three multiple value
: "<<num1*3;
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=6;
cout <<"
num value : "<<num1;
num1=num1/1;
cout
<<"\n One divide value :
"<<num1;
cout
<<"\n Two divide value :
"<<num1/2;
cout
<<"\n Three divide value :
"<<num1/3;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10