Problem Solving With C++ (Looseleaf) - With Access
Problem Solving With C++ (Looseleaf) - With Access
9th Edition
ISBN: 9780133835267
Author: SAVITCH
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 11PP
Program Plan Intro

Decryption of the intercepted message

Program plan:

  • Include necessary header files.
  • Declare the namespace.
  • Declare the function “decrypt()”.
  • Define the function “decrypt()”.
    • Declare the necessary variables.
    • Use “for” loop to iterate the string length using the function “strlen()”.
      • Encode the string and assign the result into the variable “Encrypt”.
      • The “if” loop check the condition.
        • True, use the formula to decrypt the message.
      • Otherwise, use the formula to decrypt the message.
      • Assign the decrypted message into the variable “decode[i]”.
  • Define the “main()” function.
    • Declare and initialize the necessary variables.
    • Use “for” loop to iterate the number or key between “1” to “100”.
      • Call the function “decrypt()”.
      • Print the result.
    • Return “0”.

Blurred answer
Students have asked these similar questions
Given table is the ascii value of the characters and symbols. The following code is the code for XOR Encryption: Change the input string in the driver code at the sample string. def encrypt(inpString): xorKey = 'e'     Which of the following is the message HELLO TUTOR after xor encryption, using 'e' as the key, has been applied? - ))*E101*7   -$55<E'H!$<  =$(E7 3,6   - ),"*)$+!6  Which of the following is the message HELIGOLANDS after xor encryption, using 'e' as the key, has been applied? - )5E( E5)6  - ),"*)$+!6   - ))*E207)<  - ))*E2*7)!  Which of the following is the original message before xor encryption, using 'e' as the key, created - ),"*)$+!6? HELP ME PLS  HELIGOLANDS   HELLO WURLY  HELLO WORLD
Encryption is commonly used to disguise messages on the internet. A Caesar cipher performs a shift of all of the characters in a string (based on their ASCII values, see Table 2.1), e.g. h e l l o → m j q q t The example shows a shift with a distance of 5 characters, i.e. h(ASCII:104) → m(ASCII:109) Write a C/C++ program that asks the user to input a line of plaintext and the distance value and outputs an encrypted text using a Caesar cipher, with the ASCII values range from 0 through 127. Use underscores (ASCII: 95) to represent space characters. Underscore characters should not be encrypted, and any character that is encrypted may not become an underscore. In this case, the character should be changed to the next character in the ASCII table. The program should work for any printable characters. NB: No strings (datatype) or library functions may be used. See Figure 2.1 for example output.
PYTHON3 Complete the given function, encrypt_text that encrypts the variable text using the provided key by applying a modified version of Caesar’s Cipher with the following rules: The key will contain a word made up of the letters ‘u’ and ‘d’. The cipher will use the key to determine the direction of the shift, with a ‘u’ indicating that the character must be shifted upwards while a ‘d’ indicating a downward shift. The number of characters in the key will determine the number of positions to shift. The given text variable will only contain characters from the ASCII table with values between 32 and 126. If the key is invalid (empty string, contains characters other than u and d) or the text is invalid (empty string), no encryption occurs and the function returns the original text. If the text has more characters than the key, the key will loop through again to accommodate the additional text characters. An iterative approach should be used to solve this problem. Brute force…

Chapter 8 Solutions

Problem Solving With C++ (Looseleaf) - With Access

Ch. 8.1 - What string will be output when this code is run?...Ch. 8.1 - Prob. 12STECh. 8.1 - Consider the following code (and assume it is...Ch. 8.1 - Consider the following code (and assume it is...Ch. 8.2 - Consider the following code (and assume that it is...Ch. 8.2 - Prob. 16STECh. 8.2 - Consider the following code: string s1, s2...Ch. 8.2 - What is the output produced by the following code?...Ch. 8.3 - Is the following program legal? If so, what is the...Ch. 8.3 - What is the difference between the size and the...Ch. 8 - Create a C-string variable that contains a name,...Ch. 8 - Prob. 2PCh. 8 - Write a program that inputs a first and last name,...Ch. 8 - Write a function named firstLast2 that takes as...Ch. 8 - Write a function named swapFrontBack that takes as...Ch. 8 - Prob. 6PCh. 8 - Write a program that inputs two string variables,...Ch. 8 - Solution to Programming Project 8.1 Write a...Ch. 8 - Write a program that will read in a line of text...Ch. 8 - Give the function definition for the function with...Ch. 8 - Write a program that reads a persons name in the...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that can be used to train the user...Ch. 8 - Write a sorting function that is similar to...Ch. 8 - Redo Programming Project 6 from Chapter 7, but...Ch. 8 - Redo Programming Project 5 from Chapter 7, but...Ch. 8 - Prob. 11PPCh. 8 - Write a program that inputs a time from the...Ch. 8 - Solution to Programming Project 8.14 Given the...Ch. 8 - Write a function that determines if two strings...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr