&&方程求解
clear all
input "請輸入A:" to a
input "請輸入B:" to b
input "請輸入C:" to c
if(a=0 .AND. b=0) &&當a 、b都等於0時,數據錯誤
?"輸入數據錯誤!"
return
endif
if a=0 &&判斷當a=0時,直接求解方程
x=-c/b
?"方程的解爲:",x
return
endif
if b*b-4*a*c>=0 &&判斷是否有解
x1=(-b+sqrt(b*b-4*a*c))/(2*a)
x2=(-b-sqrt(b*b-4*a*c))/(2*a)
?"方程的解爲:"
?"x1=",x1,
?"x2=",x2
else
?"方程無解"
endif