home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
l3p100.seq
< prev
next >
Wrap
Text File
|
1988-11-04
|
754b
|
34 lines
\ 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 ;