From d8c614eff3979a6e7b3c85714bb00ebcb6aec9be Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 8 May 2023 14:12:55 -0700 Subject: feat(homework_4): print cipher steps --- cst120/week_4/homework_4.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cst120/week_4/homework_4.c b/cst120/week_4/homework_4.c index be274d8..03028bf 100644 --- a/cst120/week_4/homework_4.c +++ b/cst120/week_4/homework_4.c @@ -30,6 +30,7 @@ int main(void) { do { char *caesar_cipher_encrypted_message = NULL; char *rail_fence_encrypted_message = NULL; + char *caesar_rail_fence_encrypted_message = NULL; /* Prompt and accept cipher message */ printf("Enter a message: "); @@ -43,11 +44,15 @@ int main(void) { */ caesar_cipher_encrypted_message = caesar_cipher_encrypt(user_message, &user_key); - rail_fence_encrypted_message = + rail_fence_encrypted_message = rail_fence_encrypt(user_message); + caesar_rail_fence_encrypted_message = rail_fence_encrypt(caesar_cipher_encrypted_message); /* Output final double-cipher-ed result */ - printf("%s\n", caesar_cipher_encrypted_message); + printf("Caesar cipher: %s\n", caesar_cipher_encrypted_message); + printf("Rail Fence cipher: %s\n", rail_fence_encrypted_message); + printf("Rail Fence + Caesar cipher: %s\n", + caesar_rail_fence_encrypted_message); /* Prompt user to repeat */ printf("Would you like to go again? (y/n) "); -- cgit v1.2.3