Caesar Shift Cipher, HLA

User Generated

rjnaqnjbbq

Programming

Description

If you do not know how to do it please do not do it.

Assignment 2: Caesar Shift Cipher:

read in a STREAM of text, (not just a line, a stream of
arbitrary length,) a char at a time, and as you do so,
shift each >>>letter<<< forward in the alphabet a certain
number of places.  The number of places is read from the
command line in argc[1], and turned into an int with:

(in C we'd do this:)
int shift = atoi( argc[1]) ;
Now look at args.hla and atoi.hla.  Much that is hidden comes to light:).

Example:

shift 13
Hello, Jack
Uryyb, Wnpx

READ THE COMMAND LINE FOR AN INTEGER IN ARGV[1]

Run it through conv.atoi() to convert the command line string to an integer:

an integer shift variable should now = conv.atoi( the string value from the command line) ;

you're using arg.c and arg.v to isolate the second command line string, and then
convert it to an integer value to control the shift.

Remember that if you shift a letter off the end of the alphabet, we must 
"wrap around" so we come back in down by 'a'.

Here's the pseudocode:

read in a character c

if (c is a letter )
{
	make c lowercase

	make c a number between 0 and 25

	add the shift value to c

	mod c so it's between 0 and 25 again

	add a 'a' to c so it's a real ASCII letter again.
}
print c on the output  // this happens for ALL input, not just letters!

make sure to do all the args.hla and atoi.hla
requirements

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Attached.

Caesar Shift Cipher, HLA
Name of Student
Ins...


Anonymous
I use Studypool every time I need help studying, and it never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags