n = document.forms[0].fd.value;
if ( n[0] > 0 && n > 0 && n > 0 && n > 0 && n[0] < 14 && n < 14 && n < 14 && n < 14 )
{
log("<font size=5><b>"+n[0]+", "+n+", "+n+", "+n+"的24点答案:</b></font>
");
log("<input type='button' >
");
funMain();
if ( counter == 0 )
{
log("没有答案!");
}
}
else
{
alert("输入错误!");
}
}
//主程序
function funMain()
{
var m = new Array();
//四种运算符
m[0] = "+";
m = "-";
m = "*";
m = "/";
//11种表达式
var exp1 = "a m1 b m2 c m3 d;";
var exp2 = "(a m1 b) m2 c m3 d;";
var exp3 = "(a m1 b m2 c) m3 d;";
var exp4 = "((a m1 b) m2 c) m3 d;";
var exp5 = "(a m1 (b m2 c)) m3 d;";
var exp6 = "a m1 (b m2 c) m3 d;";
var exp7 = "a m1 (b m2 c m3 d);";
var exp8 = "a m1 ((b m2 c) m3 d);";
javascript基础实例:如何计算24点(3)
80酷酷网 80kuku.com