Coding challenge

Monte Goulding monte at sweattechnologies.com
Wed Jan 30 23:53:10 EST 2013


On 31/01/2013, at 2:22 PM, Monte Goulding <monte at sweattechnologies.com> wrote:

> It would depend on what's in your wallet ;-)
> 
> On 31/01/2013, at 2:16 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:
> 
>> ...and the xtalk implementation would be...


on mouseUp
   put random(99) into tChange
   put tChange&cr&makeChange(tChange)
end mouseUp

function makeChange pChange
   repeat for each item tCoin in 50,20,10,5,2,1
      put pChange div tCoin into tCoins
      if tCoins > 0 then
         put tCoin&"x"&tCoins&cr after tReturn
      end if
      put pChange mod tCoin into pChange
   end repeat
   return tReturn
end makeChange

--
Monte Goulding

M E R Goulding - software development services
mergExt - There's an external for that!








More information about the use-livecode mailing list