Search
 
SCRIPT & CODE EXAMPLE
 

CPP

addition without arithmetic operators c++

int getSum(int a, int b) {
        while(b!=0){
            unsigned c = (a&b)<<1;
            a = a^b;
            b = c;
        }
        return a;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: binary exponentiation modulo m 
Cpp :: quadratic problem solution c++ 
Cpp :: unclebigbay 
Cpp :: resize two dimensional vector c++ 
Cpp :: remove element from vector on condition c++ 
Cpp :: c++ type of a variable 
Cpp :: separating class into header and cpp file 
Cpp :: c++ cli convert string to string^ 
Cpp :: insertion sort c++ 
Cpp :: what is _asm in C++ 
Cpp :: heap buffer overflow c++ 
Cpp :: c++ how to check whether a file exists? 
Cpp :: what is the difference between i++ and ++ i ? 
Cpp :: min element c++ 
Cpp :: c++ switch string 
Cpp :: qt disable resizing window 
Cpp :: copy array c++ 
Cpp :: C++ switch - case - break 
Cpp :: initialize whole array to 0 c++ 
Cpp :: how to put bitset into a string in c++ 
Cpp :: memcpy c++ usage 
Cpp :: flags for g++ compiler 
Cpp :: c++ max of array 
Cpp :: max_element c++ 
Cpp :: Parenthesis Checker using stack in c++ 
Cpp :: glew32.dll was not found 
Cpp :: c++ get type name of object 
Cpp :: C++ String Length Example 
Cpp :: c++ pi float 
Cpp :: pascal triangle using c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =