16 lines
505 B
Plaintext
16 lines
505 B
Plaintext
void local fn InputIntegers
|
|
while ( 1 )
|
|
CFStringRef s = input @"", @"0123456789 ", YES
|
|
if ( !s ) then end
|
|
CFArrayRef a = fn StringComponentsSeparatedByString( s, @" " )
|
|
if ( len(a) != 2 ) then beep : continue
|
|
cls : print %(150,95),a[0];@" + ";a[1];@" = ";intval(a[0]) + intval(a[1])
|
|
wend
|
|
end fn
|
|
|
|
window 1, @"A+B", (0,0,290,200)
|
|
textlabel 1, @"Enter two integers separated by space(s).\nPress 'return' to calculate or 'esc' to quit.", (20,160,270,32)
|
|
fn InputIntegers
|
|
|
|
HandleEvents
|