两道简单VFP题,要用vfp写

来源:百度知道 编辑:UC知道 时间:2024/06/30 13:09:40
1.从键盘输入年龄a1用if语句写,如果年龄小于20输出少年,如果小于50输出中年如果大于50输出老年
2.aX^2+bX+c=0,a,b,c是从键盘输入的,求方程有解

1.input "请输入年龄" to a1
do case
case a1<20
?"少年"
case a1<50
?"中年"
otherwise
? "老年"
endcase

2.input "a=" to a
input "b=" to b
input "c=" to c
s=b^2-4ac
if s>=0
?"有解"
else
?"无解"
endif

input "请输入年龄:" to li_age

if li_age<20
?"少年"
else
if li_age<50
?"中年"
else
?"老年"
endif
endif