0
Why is this program a mistake? [7]
When i try the "poker hand" challenge (https://www.sololearn.com/coach/97?ref=app) in code coach i write a code like this: https://sololearn.com/compiler-playground/cBqSQmj9SJM8/?ref=app But somehow my code can't satisfy test case 6. What should i do to fix it?
5 Réponses
+ 3
Your code is far too cryptic for me to have any interest in reading your code.
But I will GUESS two things:
1. You probably are not handling the number 10 properly.
2. The error message that appears when the code finishes could be a problem as well.
+ 1
Jerry Hobby about that, i'm sorry about my code is hard to understand. Because in the value function i tried to integrate the logic of poker rank in one operation of loops.
0
in your function "value", add a return 0;
to cover the else branch of all your if statements.
This fixes the error message and supplies the base return value of your function.
int value(int a[]){
... your codes...
//add this before the closing brace
return 0;
}
I also prettified the formatting so it would not be too hard to look at.
https://sololearn.com/compiler-playground/cn9K4Opv7O9W/?ref=app
0
Ah, i just found out that when i use input:
5S 2S 2H 3S 3C
I get a core dump.
Also i have updated the code (added some comment in value function to clarify its function process.)
Sorry, if my code is hard to understand.
0
5S 2S 2H 3S 3C
get a core dump.
but rearranging it to
3S 2S 5S 2H 3C
does not result in a core dump
the order of the cards seem to affect it.