a) Consider the function, bin, that converts an integer to a binary digit as: bin : Z 6{-1, 0, 1}, bin(x) = x congruence modulo 2. Now, define the logical NOT function as: NOT: Z\to→ {0, 1}, NOT(x)=\begin{Bmatrix} 0, if x != 0\\ 1, if x=0 \end{Bmatrix}{ 0,ifx!=0 1,ifx=0 } i) Write C++ code for the logical NOT function specified above. ii) Using the function defined in i) above, write in C++ the polymorphic logical exor function: int exor(int x, int y):- it returns x r y int exor(int * bits, int N):- it returns the exor of the N binary integers, bits. b) As a result of a) above, write in C++ the polymorphic logical not exor function, nexor: int nexor(int x, int y):- it returns the negation of x r y int nexor(int * bits, int N):- it returns the nexor of the N binary integers, bits
Hmmm... This is a tough one :(
We need the Motivation and Support! 💪
Our expert tutor in charge of answering this question
needs a cup of coffee to get pumped!
And unlock the solution to this question.