“Halt! Who goes there?” The sentinel on duty at the castle was wide awake. Our sentinel values don’t carry weapons or defend ramparts, but they perform useful guarding tasks in our programs. In computer science, a sentinel value is a value that would not normally occur in input and serves as a marker of the end of input. Occasionally they can also be in a location in an array, not at the end of the data, but representing when a condition has been met. Two examples are discussed below.
Traditional Caesar Cipher
Julius Caesar was worried. He needed to get a letter back to Cicero, the consul of Rome, but it had to travel through enemy territory. His solution? Shift every letter to the third letter after it, wrapping around so that A became D and Y became B. Here we’ll implement his idea in a computer program. Continue reading “Traditional Caesar Cipher”