SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdbool.h> | |
| 2 | #include <string.h> | |
| 3 | [...] | |
| 4 | - | bool substituirVogaisPorEspaco(char *string){
|
| 4 | + | bool trocarVogaisPorEspaco(char *string){
|
| 5 | char vogais[]="aeiouAEIOU"; | |
| 6 | ||
| 7 | bool substituiu, tmp; | |
| 8 | ||
| 9 | for( int i=0; i<strlen(vogais); i++){
| |
| 10 | tmp = substituirCaractere(string, vogais[i], ' '); | |
| 11 | if(tmp){
| |
| 12 | substituiu = tmp; | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | return substituiu; | |
| 17 | } | |
| 18 | ||
| 19 | bool substituirNumerosPorLetras(char *string){
| |
| 20 | char numeros[]="0123456789"; | |
| 21 | ||
| 22 | bool substituiu, tmp; | |
| 23 | ||
| 24 | for( int i=0; i<strlen(numeros); i++){
| |
| 25 | tmp = substituirCaractere(string, numeros[i], 'A'); | |
| 26 | if(tmp){
| |
| 27 | substituiu = tmp; | |
| 28 | } | |
| 29 | } | |
| 30 | ||
| 31 | return substituiu; | |
| 32 | } | |
| 33 | ||
| 34 | bool substituirCaractere(char *string, char antigoCaractere, char novoCaractere){
| |
| 35 | bool substituiu = false; | |
| 36 | ||
| 37 | for( int i=0; i<strlen(string); i++){
| |
| 38 | if(string[i] == antigoCaractere){
| |
| 39 | string[i] = novoCaractere; | |
| 40 | substituiu = true; | |
| 41 | } | |
| 42 | } | |
| 43 | } | |
| 44 | ||
| 45 | return substituiu; | |
| 46 | } | |
| 47 | ||
| 48 | [...] |