Jump to content

Recommended Posts

Posted

I'm trying to linking a string with real value that is in a variable, but is giving error.

 

Can you help me?

 

The little lisp only divides two numbers and displays the prompt informed with the mark.

 

 

(defun c: split ()
(setq n1 (getreal "\ nPlease enter the first value ...:"); First value
      n2 (getreal "\ nEnter the second value ...:"); According Value
      result (/ n1 n2); Results of n1 divided by n2
realstring (rtos x result)); convert the result that is real to string
     result2 (strcat "Result:" realstring);link texts
       (print result2); displaying the value
)

Thank in advance

Posted
(defun c:split ( / m n )
   (if
       (and
           (setq m (getreal "\n1st value:"))
           (setq n (getreal "\n2nd value:"))
       )
       (princ (strcat "\nResult: " (rtos (/ m n) 2)))
   )
   (princ)
)

Posted

I will put also a conditon for:

(/= n 0)

Posted

Madruga_SP, in order to see the issues in your code:

(defun [color=red]c:split[/color]()
(setq n1 (getreal "\ nPlease enter the first value ...:"); First value
      n2 (getreal "\ nEnter the second value ...:"); According Value
      result (/ n1 n2); Results of n1 divided by n2
realstring (rtos [color=red][s]x[/s][/color] result)[color=red][s])[/s][/color]; convert the result that is real to string
     result2 (strcat "Result:" realstring)[color=red])[/color];link texts
       (print result2); displaying the value
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...