+ 13
Coding Challenge #2: Convert int to string without using any built in functions (My codes included)
Stringify (By:Dao) Create a function that turns an integral numeric argument and turns it into the corresponding string version of itself. You are not allowed to use any built-in function of the language for the conversion. Did it 2 ways. First one used str+num but that would be too easy. So I did the second one using a char array. Do your code in any language and post it here. https://code.sololearn.com/cPL7R4wuIdgn/?ref=app https://code.sololearn.com/cyklaY9FseHE/?ref=app
18 ответов
+ 5
I wish there were default parameter values in java, if so 1 line would be enough.
https://code.sololearn.com/cS8dhhV1bGZ0/#java
+ 9
@pixie there is not any default implementation of toString method in java one has to override it to give its implementation so you can't object use of toString method
+ 9
converts any base number, I.e:
1024, 10 -> 1024,
FFFF, 16 -> 65535
1010, 2 -> 10
+ 8
JS Solution :D
https://code.sololearn.com/WW03IiKLeQ5V/#html
+ 8
@Pixie misread the challenge so made this one as well, you can use it for next challenge if you like:
https://code.sololearn.com/W6koJ5IRB1C4/#html
+ 7
@Tamas I'm a little confused by that code. Function overloading right?Why are the access specifiers different tho? How do you even see a question and formulate a code like this? 😅😂
+ 7
But the number of arguments vary, so why override it? I dont really understand the Java concept. (Just saying what I think here 😅)
+ 7
Ohhh. Ok
I was entering the wrong inputs haha.😂
Thanks @Nikolay 😎
+ 6
@Nikolay. Nice 😊
+ 6
Also, next challenge has been posted ^_^
https://www.sololearn.com/discuss/387579/?ref=app
+ 5
Sorry Pixie, I shouldn't name it toString, as it is a static method it is not the same as Object's toString. I will rename it.
+ 5
@nikolay I dont understand what it is 😓
Can you explain what it does?
+ 4
I tried in python:
https://code.sololearn.com/cT7A9xI9JgNM/?ref=app
waiting for replies about my flaws...
+ 3
@RiMaN: You use built in feature. It it easy in every language, in Java for example: Integer.toString(23)
+ 3
@Tamas Barta:
is it string formatter or float conversion?
+ 3
If it's about string formatting, as far as I know it's not a function. besides, integer.toString() is a method (a function indeed).
0
*** NEW DAILY CHALLENGE ***
check it out !!!
https://www.sololearn.com/discuss/567313/?ref=app