Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. //Your program must accept a single command-line argument: a keyword, k, composed entirely of alphabetical characters. ~DONE~
  2.  
  3. /*If your program is executed without any command-line arguments, with more than one command-line argument,
  4. or with one command-line argument that contains any non-alphabetical character, your program should print an error (of your choice)
  5. and exit immediately, with main returning 1 (thereby signifying an error). ~DONE~*/
  6.  
  7. /*Otherwise, your program must proceed to prompt the user for a string of plaintext, p, (as by a prompt for plaintext:) which it must then encrypt according to Vigenère’s cipher with k,
  8. ultimately printing the result (prepended with ciphertext: and ending with a newline) and exiting, with main returning 0.*/
  9.  
  10. //With respect to the characters in k, you must treat A and a as 0, B and b as 1, …​ , and Z and z as 25.
  11.  
  12. /*Your program must only apply Vigenère’s cipher to a character in p if that character is a letter.
  13. All other characters (numbers, symbols, spaces, punctuation marks, etc.) must be outputted unchanged.
  14. Moreover, if your code is about to apply the jth character of k to the ith character of p, but the latter proves to be a non-alphabetical character,
  15. you must wait to apply that jth character of k to the next alphabetical character in p; you must not yet advance to the next character in k.*/
  16.  
  17. //Your program must preserve the case of each letter in p.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement