A C++ function to figure out whether one unsigned integer is bigger than another -
I was wondering if you can help me with a function I am trying to decide Whether an unsigned integer is larger than For some reason this program outputs output to Despite the fact that you can only EDIT: There is still something wrong with my version, see. If I had to write a loop that repeats it at least one of the integer pieces of an integer, I want to move the better right as if the one you want to see is the least important Moved the result with a single Note: It's better to write one
b
# include & lt; Limits.h & gt; # Include & lt; Iostream & gt; Bool is_bigger (unsigned int one, unsigned int b) // returns are bigger than one b; Incorrectly incorrectly (for I int = 0, j = sizeof (unsigned int) * CHAR_BIT; i
true maybe something is wrong about my argument? Does anyone know about a library that I can download that can see the function which is bigger than one integer second?
operator & gt; with an unsigned integer, which means
a & gt;
1 after it is transferred to the bit:
for
(int i = sizeof (unsigned int) * CHAR_BIT - 1 ; I> ==; --i) {int b1 = (a & gt; & gt; i) & amp; 1; Int B2 = (B & gt; & gt; I) & amp; 1; If (B2 and B1) false return; } Back true;
sizeof (unsigned int) instead of
size because you can change the type of the bus
a and
b are very useful in signature without worrying about the function body, if you template it a function.
Comments
Post a Comment