+ 6
[SOLVED] Sololearn problem in C. No numerals
I really don't like to post solutions of the problems, but what am I supposed to do when the code doesn't work?!?! After all, if you don't want any spoil you can just avoid reading. That said, does anyone knows why this code doesn't work? https://code.sololearn.com/ch9vQA4IKV8y/?ref=app
5 Réponses
+ 6
At line 14:
input [i] is a char that equals its position in the ASCII table.
'0' == 48 , '1' == 49 and so on.
If you want to convert these values to the respective digits you can substract the chars by 48.
By the way this challenge includes 10 too so you'll have to do more modifications to your code.
+ 3
Problem solved ✅
Thank you all for the help! (and patience for my ignorance🙄)
You helping people are the best part of sololearn.
Ps: I haven't updated the code because, you know, I don't like to post solutions.
+ 2
Thank you very much for your help Martin and Kevin! I didn't know that the playground gives you more information about what's wrong with the code. That's nice to know.
I think I get your corrections, but my phone is at 15% and anyway I am going to sleep. I will try to make it work tomorrow. Thank you so much for your time helping me!!!
+ 2
Yes, Coder Kitten is right.
I just noticed that compiler warnings are disabled in the Code Coach Challenges, maybe that's why the OP didn't know about warnings.
Martin Taylor About newbies and testing:
Unfortunately, you are right.
Even worst is that many of the challenge-dedicated websites (where beginners go to practice what they have learned) tend to ignore certain details that are essential in the long term, reinforcing the "I don't care/No further testing required/It's already good enough" mentality.
The omission of some edge cases, the presence of challenges that can be easily overcome without even meeting the minimun requirements of their description and (looking at codewars.com) the public solutions widely voted as "best practices" when they are, at most, "clever" are some of the most disturbing examples.