0

Just started with the Substitution project.

It appears there is a close analogy between Substitution project and Scrabble lab.

In Scrabble lab, POINTS is an array that contains allotted value to the 26 alphabets. A = 1, B = 3...

In Substitution project: A will be alloted the first character entered by the user as plantext, B second character....

Am I correct? Here is my rough pseudocode:

Make two arrays as reference point:

enter image description here Make two arrays based on key value for each character entered by the user in argv1. Say ntf...e

enter image description here

Suppose the user enters in plain text: Rajeev

R as first character will be checked in Array 1 and Array 2. Once R detected, corresponding value in Key 1 will be replaced.

1 Answer 1

0

The program already has two arrays (POINTS and the text entered by user or "plaintext"). There is no reason to add any more. POINTS is in alphabetical order. Once you know the "alpha index" of a letter in plaintext, it is the index into POINTS. The "alpha index" is the relative position in the alphabet of any letter, starting with 0 ('a'). The prior psets taught skills in how to detect upper/lower case and how to convert ascii value of a character to "alpha index".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .