Message 1 of 22
Not applicable
06-19-2021
09:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Looking to further understand how letters and numbers can converge based on variables. I have (2) codes. One simply I want to type "ABC" and then get the real numbers to print "123" hence A=1 B=2 C=3. For now it only prints "abc" as typed and not the desired 123. I know that it's basically printing my variable I already typed but I though overriding this variable with the initial setq would fix this?On the contrary I want a second version that reverses this so as to type "123" and get it to print "ABC". I cannot seem to get them to work I think I am misunderstanding something.
(defun c:input (/ n1 n2)
(setq n1 '((a 1)(b 2)(c 3)))
(setq n2 (getstring "Enter Letters: "))
(setq n3 (atoi n2 n1))
(princ n3)
)(defun c:output (/ n1 n2)
(setq n1 '((1 a)(2 b)(3 c)))
(setq n2 (initget 7 "Enter Numbers: "))
(setq n3 (itoa n2 n1))
(princ n3)
)
Solved! Go to Solution.