0
No Numerals. Swift
Please comment my code. What are another ways to solve a problem? https://code.sololearn.com/cMfm6Skkqb2N/?ref=app
3 Réponses
+ 3
I don't know Swift but I can give you the Idea and you make it happen.
Create a 2D array with "zero", "one", "tow" and so on.
Then you read the input and for every number N you find you print array[ N ]
+ 1
The official way to do this in Swift is using NumberFormatter (from Foundation).
https://code.sololearn.com/cH3pZ4Z6n8bt/?ref=app
0
https://code.sololearn.com/cv26ea7wjEYP/?ref=app I accually made a code for it in java. I know it isn't swift but you can always try making a replica in swift by using the arrays and making a way to find if the input contains the numbers then replace it with the value in the array. and last but not least, print it out.