Advertisement
Guest User

7.b

a guest
Oct 16th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. char * sacaEspacios(char*frase){
  2.     int pos=0;
  3.     for(int i=0;i<strlen(frase);i++){
  4.         if(frase[i]==32){
  5.             pos = i+1;
  6.             while(frase[i]==32){
  7.                 if(frase[pos]!=32){
  8.                     frase[i]=frase[pos];
  9.                     frase[pos]=32;
  10.                 }
  11.                 else{
  12.                     pos++;
  13.                 }
  14.             }
  15.         }
  16.     }
  17.     return 0;
  18. }
  19. char * aMayusculas(char*frase,int posinicial){
  20.     static int pos=0;
  21.     if(frase[pos]>96 && frase[pos]<123){
  22.         frase[pos]=frase[pos]-32;
  23.     }
  24.     pos++;
  25.     posinicial=pos;
  26.     if(pos<strlen(frase)){
  27.         aMayusculas(frase,posinicial);
  28.     }
  29.     return frase;
  30. }
  31.  
  32. int esPalindroma(const char*frase,int posinicial, int posFinal){
  33.     static int flag=0;
  34.     static int i=0;
  35.     if(frase[i]==frase[posFinal-i]){
  36.         flag = 1;
  37.         i++;
  38.         if(i<posFinal){
  39.             esPalindroma(frase, posinicial,posFinal);
  40.         }
  41.         else{
  42.             return flag;
  43.         }
  44.     }
  45.     else{
  46.         flag =0;
  47.     }
  48.     if (flag==0){
  49.         return 0;
  50.     }
  51.     return flag;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement