Question: there something wrong in my index A Caesar (or rotation) cipher is a simple system of encoding strings by shifting every letter forward (or backward)

 there something wrong in my index A Caesar (or rotation) cipher

is a simple system of encoding strings by shifting every letter forward

there something wrong in my index

A Caesar (or rotation) cipher is a simple system of encoding strings by shifting every letter forward (or backward) by a given amount. For example, if the shift amount is 3, then the letter A becomes D. B becomes E, C becomes F, and so on. Letters near the end of the alphabet wrap around; for a shift of 3, X becomes A. Y becomes B. Z becomes 0. Write a program that inputs an entire line from the keyboard, followed by an integer shift amount. The program encodes the line and outputs the result. Here are two examples: Secret message? Attack zerg at dawn Shift amount? 3 Result: DWWDEN CHUJ DW GDZO Secret message? DWWDFN CHUJ DW GDZQ Shift amount? -3 Result: ATTACK ZERG AT DAWN Assume the input consists of letters and spaces only; the letters can be lowercase ('a-z) or uppercase (A-2). The resulting message should consist of uppercase letters only. You may assume the shift amount is in the range -26. 26. Hints: First, you can use the at() function, or array notation [ ], to access characters in the string, or to change a character: 3.at (1) = 'X'; // 3[i] = 'X' also works Second, it's very helpful to think of characters as numbers when performing these types of manipulations. Third, you might find the islower() and toupperfunctions helpful, these are discussed in the next section. Why? Since the result is uppercase, it might be easier to convert to uppercase before performing a shift, that way you only have one case to deal with when shifting.] 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int main() 8 { 9 string msg 10 int amt; 11 12 cout > amt; 17 18 19 // TODO: 2e //

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!