Why My Code Doesn't Work!? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why My Code Doesn't Work!?

When I want to compile this code using SoloLearn CodePlayground, compiler says Compilation Error! https://code.sololearn.com/cDlhqQlZ91ZS/?ref=app https://code.sololearn.com/cDlhqQlZ91ZS/?ref=app

29th Mar 2018, 10:37 PM
H. Ahmadian
H. Ahmadian - avatar
7 Answers
+ 4
But why keyboard is matter!? @Happy to help. Are they different in writing code!!!
29th Mar 2018, 11:26 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
Oh, Thank you both So Much! Really, an awkward and invisible bug! I have edit and corrected my code according to your advice. But, why it still doesn't work. I checked your codes, both working properly, but mine not!! Please check my code once again. https://code.sololearn.com/cDlhqQlZ91ZS/?ref=app
29th Mar 2018, 11:05 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
No PC @Alex. Written just using SoloLearn CodePlayground. It's very strange that why your code works properly, did you change something else in code other than Prototype Char Miss?
29th Mar 2018, 11:12 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
https://code.sololearn.com/cGGLzCue2fpx/?ref=app This code posts all 256bit ASCII chars. As you can see there are several that would look like spaces, but aren't. And this is just ASCII. In UTF-32 there are way more such characters. It can totally happen that a keyboard uses the wrong value for space and a certain app doesn't know how to interpret it. The program doesn't see spaces, characters or symbols. It just sees the encoded characters and uses them to check if an expression is valid or not. Even in the same code this can lead to problems. If you take a wstring as input and try to compare it to a normal string in an if statement you will get false even if they are the same for humans. Your PC/smartphone just doesn't know that they are different if it's not explicitly told so. Computers are stupid after all. ^^
29th Mar 2018, 11:47 PM
Alex
Alex - avatar
+ 1
I just deleted the spaces where the errors came up and reindented the lines. You could try to use another keyboard. Download Gboard or some other free keyboard.
29th Mar 2018, 11:15 PM
Alex
Alex - avatar
0
You have some invalid characters in your code. They look like spaces, but are actually not printable characters. Beside that the code works. Copy&paste your corrected code here: https://code.sololearn.com/cQPthdW583KX/?ref=app edit: oh yes and that missing char in the prototype. Totally forgot to mention it. Happy was faster :P
29th Mar 2018, 10:52 PM
Alex
Alex - avatar
0
Same error. Did you write it on a PC or in the app?
29th Mar 2018, 11:07 PM
Alex
Alex - avatar