Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int get_score(char * sequencia, int i) {
- int size = strlen(sequencia);
- if(i == size) return 0; // se ja chegamos ao final da string
- int score = get_score(sequencia, i+1);
- if(sequencia[i] == 'V') score += 3;
- else if(sequencia[i] == 'E') score++;
- return score;
- }
- void main() {
- char teste[15] = "VVVEEDDVED";
- int score = get_score(teste, 0);
- printf("A pontuacao do time foi %d\n", score); // 15
- getch();
- }
Add Comment
Please, Sign In to add comment