home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p3_23dc.seq < prev    next >
Text File  |  1990-04-05  |  741b  |  22 lines

  1. \ Problem 3.23 by Dickson Cheng  04/05/90 20:15:10.57
  2.  
  3. \ 1. Program will get crashed if input is not numeric.
  4. \ 2. Program will still run but get error result if entered with another
  5. \    Forth word.
  6. \ 3. Program will get error result if data input with spaces inside.
  7.  
  8.  
  9. : #IN   ( -- n ) QUERY INTERPRET ;
  10. : GETL  ( -- l ) CR ." Enter tank length " #IN ;
  11. : GETW  ( -- w ) CR ." Enter tank width  " #IN ;
  12. : GETH  ( -- h ) CR ." Enter tank height " #IN ;
  13. : .VOLUME ( l w h -- ) * * CR ." Volume " . ." cubic feet." ;
  14. : .AREA         ( l w h -- )
  15.         3DUP 5 ROLL * 2* -ROT * 2* + -ROT * 2* +
  16.         CR ." Surface area " . ." square feet." ;
  17.  
  18. : TANK          ( -- )
  19.         GETL GETW GETH
  20.         3DUP .VOLUME .AREA ;
  21.  
  22.