Sale!

creating a secret code

Original price was: $40.00.Current price is: $30.00.

The Problem Statement
You and your roommate are creating a secret code.

You have a rather simple scheme to express strings of letters as numbers.
You realize that since there are only 26 different letters, a string of letters can be viewed as a number in base 26!
For example, consider the word:

Category:

Description

Rate this product

The Problem Statement
You and your roommate are creating a secret code.

You have a rather simple scheme to express strings of letters as numbers.
You realize that since there are only 26 different letters, a string of letters can be viewed as a number in base 26!
For example, consider the word:

COMPUTER

You realize that we can just assign numeric values to the letters with A = 0, B = 1, C = 2, …, Z = 25 and then treat each letter location as the ones place, the 26 place, the 262 place and so forth.
Thus, the value of COMPUTER would be:

2×26^7 + 14×26^6 + 12×26^5 + 15×26^4 + 20×26^3 + 19×26^2 + 4×26^1 + 17×26^0.

Fill in the two functions to encode and decode your messages.
One function takes in a string and its length, and returns a number (stored in a data type called long long) equivalent to the string using the system described above.
The second function will take in a number and the length of the corresponding word and print out the corresponding string that is the result of decoding the first number.

Reviews

There are no reviews yet.

Be the first to review “creating a secret code”

Your email address will not be published. Required fields are marked *