怎么让while自加数字一次隔一次实现?
(defun c:ecn ()(setq b (getint "\n请输入三角内开始数字:"))
(setvar "cmdecho" 0)
(while (setq a (getpoint "\n请输入基点:"))
(progn
(setvar "cmdecho" 0)
(command "polygon" 3 a "c"1.43 "")
(command "text" "j" "mc" a 2.5 "" b "")
(setq b (1+ b))
)
)
)
现在想在画出的三角形里的数字,一次隔一次增加,应该怎么更改程序?如第一次显示1,第二次也是显示1,第三次为2,第4次为2依次类推,请各位高手多多指点,谢谢~
(setq i 0)
........
(if (= i 1)
(setq i 0)
(setq i (+ i 1) b (+ b 1))
) chg 发表于 2012-5-2 13:04 static/image/common/back.gif
(setq i 0)
........
(if (= i 1)
貌似还是不行啊,数字还是出来1,2,3,4...我想要的是,1,1,2,2,3,3,4,4,.... sundy1020 发表于 2012-5-2 14:36 static/image/common/back.gif
貌似还是不行啊,数字还是出来1,2,3,4...我想要的是,1,1,2,2,3,3,4,4,....
这样的循环还不如,直接输入数字
1时为12时为2 【KAIXIN】 发表于 2012-5-2 14:41 static/image/common/back.gif
这样的循环还不如,直接输入数字
1时为12时为2
哎,我想偷懒一点是一点,哎~ rem函数解决 yjr111 发表于 2012-5-2 14:44 static/image/common/back.gif
rem函数解决
兄台试试,这个的确新鲜!用除的方法 yjr111 发表于 2012-5-2 14:44 static/image/common/back.gif
rem函数解决
取余?弄不来,请指教~ 本帖最后由 Andyhon 于 2012-5-2 15:08 编辑
Command: (setq b 1)
1
Command: (rem (/ (1+ b) 2))
1
Command: (setq b 2)
2
Command: (rem (/ (1+ b) 2))
1
Command: (setq b 13)
13
Command: (rem (/ (1+ b) 2))
7
Command: (setq b 14)
14
Command: (rem (/ (1+ b) 2))
7
每次加0.5,再取整
页:
[1]
2