Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include C programming Cipher Lab using create a program, cipher.c, which w short assignment is to give you some practic will encode The purpose of

#include C programming

image text in transcribed

image text in transcribed

Cipher Lab using create a program, cipher.c, which w short assignment is to give you some practic will encode The purpose of this characters and Strings. You will a message by shifting each letters then A becomes C, B becomes D, and so on. Like this if the shift is 2 ome number of places. Thus it. P O R S T UV W E F G HIJ K L M N O A BCDEFGHI J KLM NOP2 R S T U V Surprisingly, you can do this by simply doing arithmetic with characters hu should reassure C that the result is a character using a cast. If, for example, a letter contains the value 'A', then 'A' 2 gives the integer result 67, w you can turn back into a character by saying (char) (letter 2), givin value 'C you nately, (char) ( ?' + 2) does not give you the letter , B "(you can see why from the picture above). But if you realize you went past 'z', you subtract 26 (so the result is z' 2 26, or 'Z' 24), and this will give you 'B This also means that if you encode a message with a shift of n, you can decode it with another shift of 26 n Your program should first call a function, processFile(), which readsa message from a file (congress.txt) into a very large character array. The function should convert all of the letters into uppercase characters. You may discard all the punctuation marks, digits, blanks, and anything else from the input string Your program should then accept the amount to shift as an input to a function cipher (). The input parameter should be 13, although for your testing purposes, you can simplify things by using a shift of 1. Your function should encode each letter by shifting it the correct amount, and put the encoded leters into null-terminated array of characters. Finally, you should create a function, outputCode(),which outputs the final encoded message in blocks of five letters, ten blocks per line. The last line may be shorter than five blocks, and the last block may be shorter than five letters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions