Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
31
Task/Four-is-magic/FutureBasic/four-is-magic.basic
Normal file
31
Task/Four-is-magic/FutureBasic/four-is-magic.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn FourIsMagic( number as CFNumberRef ) as CFStringRef
|
||||
CFMutableStringRef result = fn MutableStringNew
|
||||
NumberFormatterRef formatter = fn NumberFormatterWithStyle( NSNumberFormatterSpellOutStyle )
|
||||
NumberFormatterSetLocale( formatter, fn LocaleWithIdentifier( @"en_EN" ) )
|
||||
CFStringRef numberString = fn NumberFormatterStringFromNumber( formatter, number )
|
||||
MutableStringAppendString( result, fn StringCapitalizedString( numberString ) )
|
||||
|
||||
while ( fn StringIsEqual( numberString, @"four" ) == NO )
|
||||
numberString = fn NumberFormatterStringFromNumber( formatter, fn NumberWithInteger( len(numberString) ) )
|
||||
MutableStringAppendString( result, fn StringWithFormat( @" is %@, %@", numberString, numberString ) )
|
||||
wend
|
||||
MutableStringAppendString( result, @" is magic." )
|
||||
end fn = result
|
||||
|
||||
NSInteger i
|
||||
CFNumberRef testInput
|
||||
CFArrayRef testNumbers : testNumbers = @[@23, @1000000000, @20140, @100, @130, @151, @-7]
|
||||
|
||||
NSLog( @"Outputs 0 through 9:\n" )
|
||||
for i = 0 to 9
|
||||
NSLog( @"%@", fn FourIsMagic( fn NumberWithInteger( i ) ) )
|
||||
next
|
||||
|
||||
NSLog( @"\nOther number tests:\n" )
|
||||
for testInput in testNumbers
|
||||
NSLog( @"%@", fn FourIsMagic( testInput ) )
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue