Advertisement
SensePrompt

Vigenere

Aug 26th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <ctype.h>
  5.  
  6.  int main ( int argc, string argv[]){
  7.      
  8.    string theKey = "";
  9.      
  10.      
  11.      while (argc != 2){
  12.          
  13.          printf("You just need to type in a word!");
  14.    
  15.      
  16.        if (argv[1]) {
  17.          
  18.          int i = strlen(argv[1]);
  19.          
  20.          for (int k = 0; k < i; k++){
  21.              
  22.              if (isdigit(argv[1][i])){
  23.                  
  24.                  printf("No number should be within the word you typed!\n");
  25.                  
  26.                  return 1;
  27.                  
  28.              }  else {
  29.            
  30.              
  31.              theKey = argv[1];
  32.              
  33.              break;
  34.     }  
  35.      
  36.          }
  37.          
  38.        
  39.      }
  40.  
  41.  }
  42.  
  43.  printf("The key is %s\n", theKey);
  44.  
  45.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement