Advertisement
shadowsofme

Generate Key

Oct 4th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. char generateKey(char * ch)
  2. {
  3.     int i, j, n;
  4.     bool check1 = true, check2 = true, check3 = false; 
  5.     int length = strlen(ch);
  6.     printf("%s: %d\n", ch, length);
  7.     char *alphabet = "ZYXWVUTSRQPONMLKJIHGFEDCBA";
  8.     char *endkey = "";
  9.     for (i = 0; i < length; i++){
  10.         n = strlen(endkey);
  11.         for (j = 0; j < n; j++){
  12.             n = strlen(endkey);
  13.             printf("%s: %d\n", endkey, n);     
  14.             if (endkey[j] == ch[i]){
  15.                 check1 = false;
  16.             }
  17.                  
  18.             printf("Hi.\n");
  19.             if (check1 != false){
  20.                 printf("Hey.\n");
  21.                 strcat(ch[i], endkey);
  22.                 printf("Evening.\n");
  23.                 check3 = true;
  24.             }
  25.             check1 = true;
  26.             if (check3 == true){
  27.                 break;
  28.             }
  29.         }
  30.     }
  31.    
  32.     for (i = 0; i < strlen(alphabet); i++){
  33.         for (j = 0; j < strlen(endkey); j++){
  34.             if (alphabet[i] == endkey[j]){
  35.                 check2 = false;
  36.             }
  37.         }
  38.         if (check2 != false){
  39.             strcat(i, endkey);
  40.         }
  41.     }
  42.    
  43.     return endkey;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement