+ 1
Why is this code for Spy Life challenge coming back as a fail?
I wrote this code for the Spy Life challenge. For the first 2 visible tests, my output and expected output are the same, but they are marked as failures. I made a test file on my own and entered the same values the test did, and I get the expected output and no compiler errors. Any idea why the challenge says its incorrect? Yes, I know there are other ways to solve this challenge, but I want to know why this isn't working. https://code.sololearn.com/c1fXx3YmU4xk/?ref=app
4 Antworten
+ 2
I cant remember what was needed for the spy life...but I far as I can see from your code, your trying to remove all none alphabet and upper-case characters (apart for the '#x27; in line 33)
Your reverse routine is slightly incorrect:-
......
.......
string reversed;
for (unsigned int i = 0; i < phrase.size(); i++)
{
reversed += phrase[phrase.size() - 1 - i];
}
return reversed;
}
+ 1
Looks like that fixed it, though my version was returning the correct words. Any idea why my was returning the correct words but failing the challenge?
+ 1
Jessica Brezzo they use random words, numbers and characters in the test and all test are hidden from everyone including mods. The developers are the only ones who know exactly what the test are.
+ 1
BroFar It was doing this is the tests that were revealed (the first two tests). The output and expected output were exactly the same, but marked as incorrect.
The earlier suggestion outputs the exact same thing as my original code, but is marked correct.