home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p2_13bs.seq < prev    next >
Text File  |  1990-03-29  |  627b  |  28 lines

  1. \ Comp 462
  2. \ Balraj Sidhu   Set: 14D4
  3. \ Date: March 29, 1990
  4. \ Problem 2.13  -- Finding the error in the table
  5.  
  6.  
  7. \ New word:  .R ( n w -- )
  8. \ Print n right justified in a field w wide
  9. : .one ( n -- )
  10.         12 spaces               \ Indent table entry
  11.         dup 8 .r                \ print number
  12.         dup dup * 8 .r          \ print square of number
  13.         dup dup * * 8 .r ;      \ print cube of number
  14.  
  15. : .heading ( -- -- )
  16.         cr cr cr 14 spaces ." Number  Square    Cube" ;
  17.  
  18. : .table ( first last --- )
  19.         .heading
  20.         1+ swap
  21.         ?do cr i .one loop
  22.         cr cr ;
  23.  
  24.  
  25.  
  26.  
  27.  
  28.