>>>Gil,
>>>
>>>I think this will give you the same result as the C code:
>>
>>>rhs = 0
>>>for i = strlen( tempCustStr ) to 1 step -1
>>
>>The following is not the correct translation from C. In C you have to substract the '0' char in order to have the numerical value of a digit character. In VFP you already applied the VAL function, which gives you the numerical value directly. So, the "- 48" substraction will give you a wrong value.
>>
>>> digit = val( substr( tempCustStr, i, 1 ) ) - 48
>>> if ( i % 2 = 0 )
>>> rhs = rhs + digit
>>> else
>>> rhs = rhs + int( 2 * digit / 10 ) + ( 2 * digit ) % 10
>>> endif
>>>endfor
>>>
>>>rhs = 99 - rhs
>>>checkdigit = int( rhs / 10 )
>>>lastdigit = rhs % 10
>>>
>
>
>How is it that you're getting such wide replies. I know this is off the subject but it almost appears as if there is no reply available.
The message I replied to had HTML tags for preformated text. I inserted my reply between those tags, but I didn't format my text with CRs. Since it is between preformated tags, the browser takes it as is and doesn't format the text. So, the message is very wide.
Sorry! I will be more careful.
Vlad
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only