- 4
Can you code multiplication with only LOGICAL operations like & , ^ , | , << , >> but, without + or - or * or /
If you interested in Logical Simulations join us
14 odpowiedzi
+ 3
I haven't tested it, maybe you find some inspiration here:
https://www.phptpoint.com/cpp-program-to-multiply-two-numbers-without-using-multiplication-operator/
https://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/
Now that you have written your own add-method, you can replace the + by that
+ 2
What is it then? A challenge? You can put it in a challenge thread...
If there is an issue with the code, can you please specify what isn't working? I get a compiler warning if I don't un-comment line 42, for example.
+ 2
That is what is am saying: I get a compiler warning due to line 41
+ 2
Try to run the code on sololearn playground. It a warning about "unused variable"
+ 1
You ask a pseudo-question: you answer your own question immediately, mark your own answer as best and upvote it?
Maybe you rather want to advertise your code in an advertising thread?
https://www.sololearn.com/post/1398460/?ref=app
+ 1
Lisa you may be true but it is not sharing have you opened or understand me what is shown on the code.
+ 1
Lisa you dont need uncomment any line only you should enter two number
+ 1
You are true that i havent pay attention to this
But Lisa warning is not means the code is warking worse but if you also use unused var like me , it is not wrong
But if you pay another attention to this code it returns addition of two numbs without + operand
The mens of my checking my best ans to this quest is that the CODE IS ADDING WHITOUT + opr
I want you help like this but not add
BUT logical multiplication
+ 1
Jacob Tracey i have banchmarked my code that you are really true
Test Count: 1 234 567 890 times
Result:
(+) operand =>> 12s
My func Add =>> 1m 43s
my Add func is 9 times slower than (+) operand
0
But i dont warning on my compiler
What kind of warning is it Lisa
0
Really good that i have tested Lisa
0
Jacob Tracey not agree
0
How it is written benchmark cant understan yuo a bit Jacob Tracey
- 1
https://code.sololearn.com/c9raQdAX1A0K/?ref=app
here is some code what I am explaning