home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
p3_23dc.seq
< prev
next >
Wrap
Text File
|
1990-04-05
|
741b
|
22 lines
\ Problem 3.23 by Dickson Cheng 04/05/90 20:15:10.57
\ 1. Program will get crashed if input is not numeric.
\ 2. Program will still run but get error result if entered with another
\ Forth word.
\ 3. Program will get error result if data input with spaces inside.
: #IN ( -- n ) QUERY INTERPRET ;
: GETL ( -- l ) CR ." Enter tank length " #IN ;
: GETW ( -- w ) CR ." Enter tank width " #IN ;
: GETH ( -- h ) CR ." Enter tank height " #IN ;
: .VOLUME ( l w h -- ) * * CR ." Volume " . ." cubic feet." ;
: .AREA ( l w h -- )
3DUP 5 ROLL * 2* -ROT * 2* + -ROT * 2* +
CR ." Surface area " . ." square feet." ;
: TANK ( -- )
GETL GETW GETH
3DUP .VOLUME .AREA ;