1.
clear
accept "请输入任意一个字符:" to x
do case
case x>="A" and x<="Z"蔽手 or x>="a" and x<="z"
?"您输入的是宏唯嫌英语字母"
case asc(x)>=48 and asc(x)<=57
?"您输入的是数字"
otherwise
?"您输入的是英语字母、数学之外的特殊符号"
endcase
return
2.
clear
set talk off
e=1
m=1
do while .t.
p=1
for i=1 to m
p=p*i
endfor
if 1/p<0.000001
exit
else
e=e+1/p
m=m+1
endif
enddo
?"e=",e
set talk on
return
3.
clear
set talk off
f1=1
f2=1
?f1,f2
for i=3 to 20
f3=f1+f2
??f3
f1=f2
f2=f3
endfor
set talk on
return
程序1clear
?"1992-2020年中间的闰年有:"
for year=1992 to 2020
if year%4==0 and year%100!=0 or year%400==0
?year
endif
endfor
程序2
clear
s=0
for i=100 to 999
if i%11=0
if i%10=8 or i/10%10=8 or i/100=8
?i
s=s+1
endif
endif
endfor
?"三位数中总亏信共有销誉轮",s,"个能被11整除同时又含有8的数字"
程序3
clear
a="Long long ago,there was a war between the birds and the beats. No one knows what they fought about.The bat did not know whose side he should take. He thought and thought, "
c="then decided he must try to be on the side of the winners.So he watched from far away. After a while, it seemed that the birds were going to win.He flew over to join them"
b=""
i=1
for j=1 to len(a)
if substr(a,j,1)!=" "
b=b+substr(a,j,1)
endif
endfor
for j=1 to len(c)
if substr(c,j,1)!=" "
b=b+substr(c,j,1)
endif
endfor
?b
程序4
input "虚圆请输入数字:" to n
P=2*N-1
FOR I=1 TO P
IF I<=N
?SPACE(N-I+1)
FOR J=1 TO 2*I-1
??"*"
ENDFOR
ELSE
?SPACE(I-N+1)
FOR K=1 TO 2*(2*N-I)-1
??"*"
ENDFOR
ENDIF
ENDFOR
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)