0
Why compiler not accepting my code even then case shows correct answer
Can anyone tell me ? Why compiler not accepting my code even then case shows correct answer https://code.sololearn.com/cKjK2IEPn4rv/?ref=app
8 Respuestas
+ 3
Can you give us some more details please? What problem are you attempting to solve? Linking your code would be quite helpful too.
If you are referring to a code coach task, chances are you are only solving a single test case instead of all simultaneously, or you might be printing invisible characters that don't belong into the result. Both are hard to identify without seeing your code.
+ 2
1. #include <string> is missing
2. For a loop over string.length() the variable i has to be unsigned int
3. name[i] will only give you a single character! You can't compare this against '10', because this are two characters. For this purpose you have to work sub-strings.
Here is your code working (without these '10' case)
https://code.sololearn.com/cbWk0oN7ILa0/?ref=app
+ 1
Then post here the link to your new version. Or compare it by your self with the corrected one above.
+ 1
Delete this, it's not possible
&& (name[i]!='10')
Use unsigned int for i in the loop
for (unsigned int i =0;.........
And include <string>
Are u kidding me, or is this for the hidden camera?
0
After doing changes .. then also not accepting the code... Coding Cat ... thanks
0
Please check my code.. i already made changes in code.