Advertisement
decs4usa

vigenere

Nov 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6.  
  7.  
  8. int main(int argc, string argv[])
  9.    
  10. {
  11.     if (argc != 2) //if user doesn't run command-line argument of one or enter positive int  
  12.     {
  13.         printf("Usage: ./vigenere key\n"); //prompt them to run it again
  14.         return 1; //returning zero means everything went well
  15.     }
  16.    
  17.     for (int j = 0, n = strlen(argv[j]);  j < n; j++)  //length of the entire string. Save n as strlen for use in loop
  18.        
  19.         if (argc == 2 && isalpha(argv[j])) //if user doesn't run command-line argument of one or enter positive int and user inputs an alpha key, continue
  20.  
  21.         {
  22.             printf("ciphertext: "); //Print after collecting plaintext
  23.         }
  24.        
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement