home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p2_13dc.seq < prev    next >
Text File  |  1990-03-30  |  632b  |  25 lines

  1. \ Solution to problem 2.13
  2. \ Author: Dickson Cheng  03/30/90 18:04:29.79
  3.  
  4. : .ONE          ( n -- )
  5.         12 SPACES
  6.         DUP 8 .R
  7.         DUP DUP * 8 .R
  8.         DUP DUP * * 8 .R ;
  9.  
  10. : .HEADING      ( -- )
  11.         CR CR CR 14 SPACES
  12.         ." NUMBER  SQUARE    CUBE" ;
  13.  
  14. : .TABLE        ( first last -- )
  15.         .HEADING
  16.         1+ SWAP              \ !!! Should check if last > first
  17.         ?DO CR I .ONE LOOP   \ !!! and the cube of "last" should not
  18.         CR CR ;              \ !!! be greater than 32767.
  19.  
  20. : MESSAGE       ( -- )
  21.         DARK CR ." To run .TABLE type first last .TABLE" ;
  22.  
  23. MESSAGE
  24.  
  25.