all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# Helper procedures
proc f {x} {expr {abs($x)**0.5 + 5*$x**3}}
proc overflow {y} {expr {$y > 400}}
# Read in 11 numbers, with nice prompting
fconfigure stdout -buffering none
for {set n 1} {$n <= 11} {incr n} {
puts -nonewline "number ${n}: "
lappend S [scan [gets stdin] "%f"]
}
# Process and print results in reverse order
foreach x [lreverse $S] {
set result [f $x]
if {[overflow $result]} {
puts "${x}: TOO LARGE!"
} else {
puts "${x}: $result"
}
}