Quote:
Originally posted by edmun3
Thanks for your explaination andrewst,the first problem[How to find out there is error object] solved.
The second one unsolved yet because I have > 400 1's to compare !!!!!!
For the looping process , I am too dump to understand it.Can you explain more further ,Dear Andrewst
====================
FOR i = 1 TO 9 DO
isset(10-i) = result AND 2 ** i
END DO
=====================
|
OK, I'm not sure if I used the correct syntax for
VB, but what I was doing was obtaining powers of 2 from 1 to 9, using the syntax 2**i to mean (2 to the power of i) - ** is the power operator in some languages.
So:
2**1 = 2 = 000000010
2**2 = 4 = 000000100
2**3 = 8 = 000001000
etc.
I now see that I missed 2**0 = 1 = 000000001 ! So my code should have been:
FOR i = 0 TO 8 DO
isset(9-i) = result AND 2 ** i
END DO
So what it does is:
1st loop iteration: sets isset(9) = result AND 000000001
2nd loop iteration: sets isset(8) = result AND 000000010
3rd loop iteration: sets isset(7) = result AND 000000100
...
9th loop iteration: sets isset(1) = result AND 100000000
The "isset" array then shows which bits were 1/0 in result: if isset(i) = 0 then the ith bit was 0, else it was 1