CSC 101 / CPE 101:
Fundamentals of Computer Science 1


Spring 2001
(Sections 03 & 06 only)
More Information on Lab # 8

This document supports the main write-up for Lab 8. It contains additional detail on how to approach various required tasks:
  1. Prompt for and read an encryption key.
  2. Build the cipher[] tool.
  3. Prompt for and read an input String to be encrypted.
  4. Encrypt the String you received.
  5. Display the encoded message.
  6. Offer to loop for more.

  1. Prompt for and read an encryption key. This is size of the offset.
  2. Generate a character array of length NUM_CHARS to hold the ciphered equivalent of each character in the user input (which you'll gather in a moment...).

    That is, if the array is called cipher[ ], then: cipher[0] should hold the ciphered equivalent of an 'a'; cipher[1] should hold the ciphered equivalent of 'b'; and so on. Make sure you understand why that is the most appropriate way to do this. In addition:


  3. Prompt for and read an input String to be encrypted.

  4. Encrypt the String you received, according to the following rules:

  5. Display an output String that is the input String encrypted by the offset key.

  6. When the encryption of a given String has been completed, ask the players if they want to encode another one, and repeat the process if they type y (as either y or Y). Otherwise, exit gracefully, acknowledging that the program run has completed. Be aware, however, that this step does not require any work with arrays, and arrays are what you should be practicing with this lab, so it's far more important that you do the rest of the tasks than that you complete this one.

Site Navigation Links:
Back: The opening page of this lab
Up: This Instructor's CSC-101 HomePage
Way Up: This Instructor's HomePage

Copyright © 2000-01 by Carol Scheftic & Phil Nico. All rights reserved.
Requests to reuse information from this page should be directed to Carol Scheftic.
Page created 1 April 2001; last updated 21 May 2001