Outline ·
[ Standard ] ·
Linear+
ASP calculator, how to create ?
|
TStpk1031
|
Jan 12 2006, 12:38 PM, updated 20y ago
|
|
guys.. i'm tryin to create a calculator..
there's a field for me to type the formula
eg. 1 + 3 / (2*2)
so..when i submited the string
a = "1+3/(2*2)"
can i just straight convert the a to a math formula and give me the output
P/s : i wanna do something like the EXCEL, we can use type in the formula and get the instant output
thanx in advance
|
|
|
|
|
|
wangpr
|
Jan 12 2006, 12:42 PM
|
|
My suggestion website Programming heavenMy diploma assignment also do calculator in Pascal. I go modified the code from this website Then get high marks
|
|
|
|
|
|
erictioh84
|
Jan 15 2006, 04:18 PM
|
|
u can do it that way but not very easy. you must use a loop with stack to recognize those operators.
|
|
|
|
|
|
littleway
|
Jan 22 2006, 11:54 PM
|
|
CODE <html>
<head> <title>Javascript Testor</title> <script language="javascript"> function test() { document.writeln("This is the output: <br> <br> <hr> <br>"); var a; a=prompt("Enter your calculations syntax eg: 1+2-1:","" ); document.write("<script language=javascript> var total; total="+a+";<\/script>"); if(total<99999999999999999999999999999999999999999999999&&total>-99999999999999999999999999999999999999999999) { document.write("You Have entered "+a+"<br>The answer..:"+total+" <br><br> <input type=submit value=Back onclick=history.back();>"); } else { document.write("Invalid syntax or invalid arguement has been entered <br><br><input type=submit value=Back onclick=history.back();>"); } } </script> </head>
<body> Simple JavaScript Calculator. <br> Eg: 3+5+6? enter 3+5+6 to get the answer.<br><br> <input type="submit" value="start" onclick="test();"> <!-writen by (!-.-)™ Productions in 2004. For personal use purpose only.-!> </body> </html>
this is what i written in javascript few years ago... Do you mean a calculator like this?
|
|
|
|
|