Arithmetic evaluation: Difference between revisions
Content added Content deleted
(add RPL) |
(Added FutureBasic solution) |
||
Line 2,348: | Line 2,348: | ||
> 71 |
> 71 |
||
</pre> |
</pre> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
_window = 1 |
|||
begin enum 1 |
|||
_expressionLabel |
|||
_expressionFld |
|||
_resultLabel |
|||
end enum |
|||
void local fn BuildUI |
|||
editmenu 1 |
|||
window _window, @"Arithmetic Evaluation", (0,0,522,61) |
|||
textlabel _expressionLabel, @"Expression:", (18,23,74,16) |
|||
textfield _expressionFld,,, (98,20,300,21) |
|||
textlabel _resultLabel,, (404,23,100,16) |
|||
WindowMakeFirstResponder( _window, _expressionFld ) |
|||
end fn |
|||
void local fn EvaluateExpression( string as CFStringRef ) |
|||
ExpressionRef expression = fn ExpressionWithFormat( string ) |
|||
textlabel _resultlabel, fn StringWithFormat( @"= %@", fn ExpressionValueWithObject( expression, NULL, NULL ) ) |
|||
end fn |
|||
void local fn DoDialog( ev as long, tag as long ) |
|||
select ( ev ) |
|||
case _btnClick : fn EvaluateExpression( textfield(tag) ) |
|||
end select |
|||
end fn |
|||
fn BuildUI |
|||
on dialog fn DoDialog |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
[[file:Arithmetic expression FB.png]] |
|||
=={{header|Go}}== |
=={{header|Go}}== |