RudeJake

Untitled

Sep 15th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  5.  
  6.  
  7. char* decrypt(char[]);
  8.  
  9. void main()
  10. {
  11.     int r;
  12.     char *s, crypto[] ="Btwlzx Dqqes Eq|pj2 Tjhvqujs Iqoqjy bpg Eqfxtx Xcwwtt";
  13.     s = decrypt(crypto);
  14.     //ככה מדפיסים
  15.     printf("%s\n",s);
  16. }
  17.  
  18.  
  19. char* decrypt(char crypto[])
  20. {
  21.     char *new_string;
  22.     char c;
  23.     int g, i=0,j=0, count_of_crypto=0,pl=0;
  24.     for (crypto[i]; crypto[i] != '\0' ; i++)
  25.         count_of_crypto++;
  26.     new_string = (char *)malloc(count_of_crypto * (sizeof(char)));
  27.     for (g = 0; g < count_of_crypto; g++)
  28.     {
  29.         c = crypto[pl];
  30.         if (c == 32)
  31.         {
  32.  
  33.             new_string[pl] = ' ';
  34.             j=0;
  35.             c = crypto[pl+1];
  36.             pl++;
  37.         }
  38.         new_string[pl] = c - (j+1);
  39.         pl++;
  40.         j++;
  41.     }
  42.     *(new_string + count_of_crypto) = '\0';
  43.     return new_string;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment