C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 21, Problem 21.14E
Program Plan Intro

Program Plan:

  • Include header files.
  • Make two character arrays “ a” and “ b ”.
  • Get the message in “ a ”.
  • Use “strlen()” function to get length of the entered message in variable “ len ”.
  • Run the for loop for value 1 to len
    • Convert every character to lowercase using “tolower()” function.
    • If character is not space then check that if we add 13 to the current character i.e. a[i], the resultant character is less than or greater than character ‘z’.
    • If not going beyond ‘z’ then make b[i]=a[i]+13.
    • else make b[i]=a[i]-13.
    • If current character a[i] is space make b[i]=a[i], which means putting space in array b.
    • End of for loop
    • Put ‘\0’ − null character in the end of array b.
    • Display the array b as encrypted message.

Blurred answer
Students have asked these similar questions
python: a function that counts the number of occurrences of given character in a given string. For example, calling the function with  Count(‘j’, ‘just joshin’) returns 2. Note the function counts the character regardless of case.
plase skip it if you dont know the correct answer i need it urgent. Will doewnvote in case of wrong or copied answers from chegg or bartleby! A regular expression (shortened as regex or regexp; also referred to as rational expression) is a sequence of characters that specifies a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. using regex create a python program to verify the string having start and end  from vowel? It should return True otherwise false.
3. String (a) Write a Python function that accepts a string s and an integer n with a single digit (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9) as its arguments, and returns a new string that replaces every digit n found in s by a new digit that equals to (n + 1) %10. The function returns an empty string if n is not a single digit integer or is negative. COMP132 Assignment #2 replace_string("He330", 3)-> "He440" "He331" replace_string("He330",0)-> replace_string("He330",-4) replace_string("He330", -> 12)-> 11 11 11 11 (b) Write a Python function that accepts a string as the argument, moves the first 3 characters of the string to the end, and prints it out. If the length of the string is less than 3, your function should print an error message. move_string ("Hello") ->loHel move_string ("Hi, My name is Mark.") -> My name is Mark. Hi, move_string ("Hi")->Invalid String
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning