home *** CD-ROM | disk | FTP | other *** search
- \ Numeric Input using QUERY and INTERPRET and an example
-
- \ Super simple numeric input.
- : #IN ( -- n )
- QUERY INTERPRET ;
-
- \ Input length.
- : GETL ( -- l )
- CR ." Enter tank length " #IN ;
-
- \ Input width.
- : GETW ( -- w )
- CR ." Enter tank width " #IN ;
-
- \ Input height.
- : GETH ( -- h )
- CR ." Enter tank height " #IN ;
-
- \ Compute volume.
- : .VOLUME ( l w h -- )
- * * CR ." Volume " . ." cubic feet." ;
-
- \ Compute surface area.
- : .AREA ( l w h -- )
- 3DUP 5 ROLL * 2* -ROT * 2* + -ROT * 2* +
- CR ." Surface area " . ." square feet." ;
-
- \ This is the tank program with prompted input
- : TANK ( -- )
- GETL GETW GETH
- 3DUP .VOLUME .AREA ;
-
-
-