Re: Euler Project Problems.
[email protected] (Albert van der Horst) Tue, 20 May 2008 22:29:23 +0200
| Newsgroups | gmane.comp.lang.forth.colorforth |
|---|---|
| Message-ID | <[email protected]> |
On Mon, May 19, 2008 at 10:42:13PM -0600, Ray St. Marie wrote: > Dear John. Albert, > Ray here... > > > > my guess is 0 constant U>D > > > >> > > -John Rible <SNIP> > > : READ.DECIMAL.NUMBER \ ( --- >> "number.string" ) > 1 TO PRECISION \ Reset precision > BL WORD \ get from input > COUNT \ String.address length > DUP 0= ABORT" Please input a number" > DUP length ! \ Remember! > 0 DO \ Convert each digit > C@ \ C@+ is this a typing error? RAS 080519 > ASCII->BINARY > I num digit! \ to binary in number. > LOOP DROP \ Drop string address. > 10 current.base digit! \ Start with decimal > 0 current.base CELL+ ! \ Guard decimal for the overflow > ; Here is the problem. C@+ is *not* a typo. It is an alias for COUNT. Replace it with COUNT, and be victorious. <SNIP> Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- like all pyramid schemes -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst