Toggling using bit-wise XOR Operator


# include <iostream.h>
# include <conio.h>
void main ()
{
    int a , b ;
    a = 9 ;
    b = 11 ;
    cout<<"originalvalue="<<a<<endl;
    cout<<"Toggled value=" <<(a^15);
    cout<<"\n original value="<<b<<endl;
    cout <<"\n Toggled value="<<(b^15);
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|