Code Red > AutoLISP (Vanilla / Visual)

Challenge ( cylinder volume )

(1/5) > >>

Mark:
Calculate the volume of a cylinder given diameter and height. However, to make it a challenge you can not use any variables. You must prompt the user for for both diameter and height, include error checking for negative numbers, zero and <enter>. Local functions are allowed.

have fun!

MP:
<sitting on hands for now>

 :evil:

ElpanovEvgeniy:

--- Quote from: Mark Thomas on March 31, 2006, 11:29:56 AM ---you can not use any variables.
--- End quote ---
Whether truly I have understood, what it is impossible to use SETQ?

MP:
If I understand Mark's intent, and I believe I do, he meant you cannot use set or setq.

MP:
For fun I offer --


--- Code: ---(defun c:foo ( )
    (princ
        (strcat "Volume of cylinder = "
            (rtos
                (   (lambda ( foo )
                        (*  pi
                            (expt (foo "\nEnter radius: ") 2)
                            (foo "\nEnter height: ")
                        )
                    )
                    (lambda ( pmt ) (initget 7) (getdist pmt))
                )
            )
        )
    )
    (princ)
)
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version