Advertisement
jaVer404

vigenere_02

Apr 28th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cs50.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. /*----function declaration-*/
  7. bool checkArgs (int num, string input);
  8. int shift(char c);
  9.  
  10. /*---------------------------*/
  11. int main (int argc, string argv[])
  12. {
  13.     if (checkArgs (argc, argv[1]))
  14.     {      
  15.         string userInput = get_string("plaintext:  ");//получаем ввод пользователя
  16.         int inputLength = strlen(userInput);
  17.         int codLen = strlen((argv[1]));
  18.         int i, c;
  19.        
  20.         for (i = 0; i < inputLength; i++)//пройти все символы из ввода
  21.         {
  22.            
  23.         }
  24.     }
  25.     else
  26.     {
  27.         printf("Usage: ./vigenere keyword\n");
  28.         return 1;
  29.     }
  30. }
  31.  
  32.  
  33. /*-------------------------------------*/
  34. bool checkArgs (int num, string input)
  35. {
  36.     if (num != 2)
  37.     {
  38.         return false;
  39.     }
  40.     int i, f;
  41.     for (i = 0, f = strlen(input); i < f; i++)
  42.     {
  43.         if (isalpha(input[i]))
  44.         {
  45.             //nothing
  46.         }
  47.         else
  48.         {
  49.             return false;
  50.         }
  51.     }
  52.     return true;
  53. }
  54. /*-------------------------------------*/
  55. int shift(char c)
  56. {
  57.     return tolower(c)-97;
  58. }
  59. /*---------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement