Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
bartleby

Concept explainers

Question
Book Icon
Chapter 11, Problem 6PC
Program Plan Intro

String Encryption

Program Plan:

  • Include the required header files.
  • Define the class “EncryptableString”.
    • Define the necessary functions and variables.
    • Define the constructor to initialize the required variables and methods.
  • Define the “encrypt()” function.
    • Declare and initialize the necessary variables.
    • Define a loop that iterates to encrypt the given string by replacing the alphabets of the given string with its successor in the ASCII order.
  • Define the “main()” function.
    • Declare and define the necessary variables.
    • Get the input string from the user to perform encryption.
    • Object for the class “EncryptableString” gets created and instantiated to access the function of the class.
    • Make a call to the function “encrypt()” to encrypt the string.
    • Displays the given string after encryption.

Blurred answer
Students have asked these similar questions
Homework 10-1 Programming Challenge: 2 - Backwards String Write a function that accepts a string and returns a string in which the contents are the reverse of the original string, and a program in which this function is demonstrated.      The prototype is   string reverseString(const string &); This might need a little explanation. We want to pass the string by reference (as is customary for objects) but we don't want the function to make any changes to our string. Thus, we pass as a "constant reference." Newer languages like Java do this automatically; if you pass an object to a Java method, it's handled internally kind of like this, as a constant reference to that object. Any changes made to the object within the function are strictly local; the original object is unchanged. So our function will return a brand new string with contents equal to the reverse of the string sent to the function.
Exercise Objectives Problem Description Write a program that reads a string and mirrors it around the middle character. Examples: abcd becomes cdab. abcde becomes deCab AhmadAlami becomes AlamiAhmad Page 1 of 2 Your program must: • Implement function void reflect (char* str) which receives a string (array of characters) and mirrors it. This function does not print anything. • Read from the user (in main()) a string and then print the string after calling function reflect(). • Use pointers and pointer arithmetic only. The use of array notation and/or functions from the string.h library is not allowed.
String Pair   // Problem Description   // One person hands over the list of digits to Mr. String, But Mr. String understands only strings. Within strings also he understands only vowels. Mr. String needs your help to find the total number of pairs which add up to a certain digit D.       // The rules to calculate digit D are as follow       // Take all digits and convert them into their textual representation       // Next, sum up the number of vowels i.e. {a, e, i, o, u} from all textual representation       // This sum is digit D       // Now, once digit D is known find out all unordered pairs of numbers in input whose sum is equal to D. Refer example section for better understanding.       // Constraints   // 1 <= N <= 100       // 1 <= value of each element in second line of input <= 100       // Number 100, if and when it appears in input should be converted to textual representation as hundred and not as one hundred. Hence number…

Chapter 11 Solutions

Starting Out with C++: Early Objects

Ch. 11.5 - When is a copy constructor called?Ch. 11.5 - How does the compiler know that a member function...Ch. 11.5 - What action is performed by a classs default copy...Ch. 11.6 - Assume there is a class named Pet. Write the...Ch. 11.6 - Assume that dog and cat are instances of the Pet...Ch. 11.6 - What is the disadvantage of an overloaded ...Ch. 11.6 - Prob. 11.17CPCh. 11.6 - Prob. 11.18CPCh. 11.6 - Assume there is a class named Animal, which...Ch. 11.6 - Prob. 11.20CPCh. 11.6 - Describe the values that should he returned from...Ch. 11.6 - Prob. 11.22CPCh. 11.6 - What type of object should an overloaded operator...Ch. 11.6 - Prob. 11.24CPCh. 11.6 - If an overloaded or operator accesses a private...Ch. 11.6 - Prob. 11.26CPCh. 11.6 - When overloading a binary operator such as or as...Ch. 11.6 - Explain why overloaded prefix and postfix and ...Ch. 11.6 - Prob. 11.29CPCh. 11.6 - Overload the function call operator ( ) (int i,...Ch. 11.8 - Prob. 11.31CPCh. 11.8 - Prob. 11.32CPCh. 11.8 - Prob. 11.33CPCh. 11.8 - Prob. 11.34CPCh. 11.11 - What type of relationship between classes is...Ch. 11.11 - Why does it make sense to think of a base class as...Ch. 11.11 - What is a base class access specification?Ch. 11.11 - Think of an example of two classes where one class...Ch. 11.11 - What is the difference between private members and...Ch. 11.11 - What is the difference between member access...Ch. 11.11 - Suppose a program has the following class...Ch. 11.12 - What is the reason that base class constructors...Ch. 11.12 - Why do you think the arguments to a base class...Ch. 11.12 - Passing arguments to base classes constructors...Ch. 11.12 - Prob. 11.45CPCh. 11.12 - Prob. 11.46CPCh. 11 - If a member variable is declared _____, all...Ch. 11 - Static member variables are defined _____ the...Ch. 11 - A(n) _____ member function cannot access any...Ch. 11 - A static member function may be called _____ any...Ch. 11 - A(n) _____ function is not a member of a class,...Ch. 11 - A(n) _____ tells the compiler that a specific...Ch. 11 - _____ is the default behavior when an object is...Ch. 11 - A(n) _____ is a special constructor, called...Ch. 11 - _____ is a special built-in pointer that is...Ch. 11 - An operator may be _____ to work with a specific...Ch. 11 - When the _____ operator is overloaded, its...Ch. 11 - Making an instance of one class a member of...Ch. 11 - Object composition is useful for creating a(n)...Ch. 11 - A constructor that takes a single parameter of a...Ch. 11 - The class Stuff has both a copy constructor and an...Ch. 11 - Explain the programming steps necessary to make a...Ch. 11 - Explain the programming steps necessary to make a...Ch. 11 - Consider the following class declaration: class...Ch. 11 - Describe the difference between making a class a...Ch. 11 - What is the purpose of a forward declaration of a...Ch. 11 - Explain why memberwise assignment can cause...Ch. 11 - Explain why a classs copy constructor is called...Ch. 11 - Explain why the parameter of a copy constructor...Ch. 11 - Assume a class named Bird exists. Write the header...Ch. 11 - Assume a class named Dollars exists. Write the...Ch. 11 - Assume a class named Yen exists. Write the header...Ch. 11 - Assume a class named Length exists. Write the...Ch. 11 - Assume a class named Collection exists. Write the...Ch. 11 - Explain why a programmer would want to overload...Ch. 11 - Each of the following class declarations has...Ch. 11 - A derived class inherits the _____ of its base...Ch. 11 - The base class named in the following line of code...Ch. 11 - The derived class named in the following line of...Ch. 11 - In the following line of code, the class access...Ch. 11 - In the following line of code, the class access...Ch. 11 - Protected members of a base class are like _____...Ch. 11 - Complete the following table by filling in...Ch. 11 - Complete the following table by filling in...Ch. 11 - Complete the following table by filling in...Ch. 11 - When both a base class and a derived class have...Ch. 11 - When both a base class and a derived class have...Ch. 11 - An overridden base class function may be called by...Ch. 11 - Each of the following class declarations and/or...Ch. 11 - Soft Skills 44. Your companys software is a market...Ch. 11 - Check Writing Design a class Numbers that can be...Ch. 11 - Day of the Year Assuming that a year has 365 days,...Ch. 11 - Day of the Year Modification Modify the DayOfYear...Ch. 11 - Number of Days Worked Design a class called...Ch. 11 - Palindrome Testing A palindrome is a string that...Ch. 11 - Prob. 6PCCh. 11 - Corporate Sales A corporation has six divisions,...Ch. 11 - Prob. 8PCCh. 11 - Rational Arithmetic II Modify the class Rational...Ch. 11 - HTML Table of Names and Scores Write a class whose...
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,