its not really a tutorial its just the code :( i need to know how to edit it and test it without a test server. tnx, Max
<!--- SET PARAMETER
VALUES FOR A & B --->
<cfparam name="a"
type="numeric"
default="0">
<cfparam name="b"
type="numeric"
default="0">
<cfparam name="form.q"
type="any" default="+">
<!--- CREATE A FORM THAT LEADS TO ITSELF i.e. CFFORM
ACTION="PAGE NAME.CFM" --->
<cfform action="calc1.cfm"
method="POST"
enablecab="Yes" name="calc">
<table>
<tr>
<td>VALUE A</td>
<td><cfinput type="Text"
name="a" value="#a#"
validate="float"
required="Yes"></td>
</tr>
<tr>
<td colspan="2">
<!--- YOU CAN USE THE "SPECIAL
CHARACTER" FEATURES FOR THIS --->
<cfinput type="Radio"
name="q"
value="+" checked="Yes">
<b>+</b>
<cfinput type="Radio"
name="q"
value="-">
<b>-</b>
<cfinput type="Radio"
name="q"
value="X">
<b>×</b>
<cfinput type="Radio"
name="q"
value="/">
<b>÷</b>
<cfinput type="Radio"
name="q"
value="^"> A<sup>b</sup>
<cfinput type="Radio"
name="q"
value="root"> B
root A (A<sup>1/b</sup>)
<cfinput type="Radio"
name="q"
value="%"> B%
Of A</td>
</tr>
<tr>
<td>VALUE B</td>
<td><cfinput type="Text"
name="b" value="#b#"
validate="float"
required="Yes"></td>
</tr>
<tr>
<td colspan="2"
align="center" valign="middle"><hr><input
type="submit" name="get"
value="Get Answer"></td>
</tr>
<!--- WRITE IF STATEMENTS FOR EARCH
DIFFERENT MATHEMATICAL OPERATION --->
<cfset a= a>
<cfset b= b>
<cfif form.q is "+">
<cfset c= a + b>
<cfelseif form.q is "-">
<cfset c= a - b>
<cfelseif form.q is "X">
<cfset c= a * b>
<cfelseif form.q is "/">
<cfif b equal 0>
<cfset c=
"undefined">
<cfelse>
<cfset c= a /
b >
</cfif>
<cfelseif form.q is "^">
<cfset q =
"raised to">
<cfset c = a ^ b>
<cfelseif form.q is "%">
<cfset c = a *( b / 100)>
<cfelse>
<cfif b equal 0>
<cfset c =
"undefined">
<cfelse>
<cfset c= A ^
( 1 / b)>
</cfif>
</cfif>
<!--- FILANNLY PRESENT THIS ANSWER --->
<tr>
<td align="right"><cfoutput>(#a#)
#q# (#b#) =</cfoutput></td>
<td><cfinput type="Text"
name="c" value="#c#"
required="No"></td>
</tr>
</table>
</cfform>
its not really a tutorial its just the code :( i need to know how to edit it and test it without a test server. tnx, Max
I think using the switch/case option is the way to go.
If answer number is 4.453554353453 How to make, that it shows only 4.45 Thanks!