Question: Use switch statement Homework 5: Simple Transposition Cipher The 1st fo switch as Transposition Cipher (loop) is a very simple transposition cipher encrypt can be



Use switch statement
Homework 5: Simple Transposition Cipher The 1st fo switch as Transposition Cipher (loop) is a very simple transposition cipher encrypt can be described by the following rules 1. If the length of S is 1 or 2, then encrypt(s) is S. 2. 2. For every 4 characters read in, "switch" the first two characters with the second two characters For example, encrypt('ok") *Ok" and encrypt "12345678") 34127856". Write a program to implement this cipher, given a text file "input.txt". Start with the sample program found at page 437 (Program 7-8) as a basis for your program. In this program, lines 28 and 29 will be replaced by a call to encrypt declared below. void encrypt( FILE spInput, FILE spoutput) // you fill this out Input Format Lines 1.. : The whole file (can be any number of lines) should be read in as a characters. Sample Input (file Input.txt) ?? Early And often! tput Format Last Line: One integer: the total number of characters in the string Lines 1..next to last ling: The enciphered string stTear Aly ondenft! 21 ters re ad utput Explanation Here's each character in the string as we are supposed to read it in, separated with and ".." so we can see the newlines, spaces and grouping of 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
