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

Videos

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

Removing a String Using Iterators.

Program Plan:

  • Include the required header files.
  • Define the “main” function.
    • Create string variableline with a value.
    • Create string variable str1 with the string to erase.
    • Display the value of line variable.
    • Transformthe value of line to lower case.
    • Declare an integer variable found and assign -1.
    • Iterate using a loop till there is a “first” within line.
      • Get the starting location of “first” within line and assign to found.
      • Erase the characters from location found according to the length of str1.
    • Display the value of line after modification.

Blurred answer
Students have asked these similar questions
(Even or Odd) Write a program that inputs a series of integers and passes them one at a timeto function isEven, which uses the remainder operator to determine whether an integer is even. Thefunction should take an integer argument and return 1 if the integer is even and 0 otherwise.
(Sort three numbers) Write the following function to display three numbers in increasing order: def displaySortedNumbers(num1, num2, num3): Write a test program that prompts the user to enter three numbers and invokes the function to display them in increasing order. Here are some sample runs:
(Count the letters in a string) Write a function that counts the number of letters in a string using the following header: def countLetters(s) : Write a test program that prompts the user to enter a string and displays the number of letters in the string. the answer should be in python.
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
Introduction to Variables; Author: Neso Academy;https://www.youtube.com/watch?v=fO4FwJOShdc;License: Standard YouTube License, CC-BY