Bitwise NOT in C++ | SoloLearn: Learn to code for FREE!

+1

Bitwise NOT in C++

I want to perform bitwise xnor by using NOT and XOR but it doesn't seem to work. I would like to perform the operation on strings.

2/25/2021 1:46:01 PM

Surendra Rajawat

17 Answers

New Answer

+2

it works: https://code.sololearn.com/cmiwUisdRYYP/?ref=app

+6

xor bitwise operator: A ^ B not bitwise operator: ~ C (not the 'dash', but the 'tilde') xnor => ~ (D ^ E) parenthesis are highly recommended as operator precedence are not always the same in each languages...

+3

if you iterate over the char values of each character inside the string, yes it should work...

+3

you could be more attentive to people giving help to you, and not too quickly blame them to not be polite as they are taking on their own time... and maybe you could thanks by upvoting at least, and mark the best answer ^^

+2

do you ask me to coding for you? that's not how it works: we are here to help, not to do code for you ^^ you should try your own attempt first, and then if you stuck, you could request for help... one thread for one question/problem, if no similar threads found ;P

+1

Use string.h bitwise is used for boolean...

0

Tried it and it doesn't work

0

Could you please show by writing a code , that would be helpful

0

Thanks, can the above code work for strings of alphabets

0

I didn't ask you to code for me the second time, I simply asked whether it works with strings, which has a simple reply Yes/No.

0

Thank you, see how simple it was.

0

You could have been a little polite

0

I've been polite... but your last question was unclear, all the more that you firstly reply "tried it and it doesn't work", never give upvote nor mark best answer: that would have let me guess you're asking to code for you ^^

0

Your first answer was my first try when I was working on project and it wasn't working as expected, and I have been trying to work on it for a long.

0

Secondly I would never ask anyone to code for me, because I don't like to take someones else's work as mine.

0

You mean I compare every bit of the string and produce the output accordingly.

0

I tried it like this int a = 'A'; It gives the decimal value for the letter 'A' as 65. And then performing NOT works,, but I don't know how to convert it back to string