Thursday 22 March 2012

Lecture: 14


                                                Lecture 14
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++;
    cout <<" a Incremented 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--;
    cout <<" a Decremented 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 << "It is a condition check \n";
    cout <<"It is a true : "<< (a>1 && a==4) << endl;
    cout <<"It is a false : "<< (a>1 && a!=4) << endl;
  getch();
  return 0;
}


Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10