Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 8PC
Program Plan Intro
“replaceSubstring” Function
- Include the required header files to the program.
- Declare function prototype which is used in the program.
- Define the “main()” function.
- Declare the required variables.
- Get the input strings from the user and call the function “repalceSubstring” with the input strings.
- Print the result.
- Define the “repalceSubstring” function.
- Check the second and third strings, if both the strings are equal return null.
- Find the first occurrence of the second string in the first string and store in the variable.
- Replace that word with the third string.
- Find the next occurrence of the string and replace.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
8. Sentence Capitalizer
Write a program with a function that accepts a string as an argument and returns a copy
of the string with the first character of each sentence capitalized. For instance, if the argu-
ment is “hello. my name is Joe. what is your name?" the function should return the string
"Hello. My name is Joe. What is your name?" The program should let the user enter
a string and then pass it to the function. The modified string should be displayed.
Question Mo
Write a function that accepts a pointer to a C-string as its argument. The function should count the number of times the character ‘G’ or the character ‘H’ occurs in the argument and return that number.
Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
08.
Chapter 12 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 12.2 - Write a short description of each of the following...Ch. 12.2 - What will the following program segment display?...Ch. 12.2 - Prob. 12.3CPCh. 12.2 - Prob. 12.4CPCh. 12.2 - Write code that uses the cin.get1ine function read...Ch. 12.2 - Indicate whether the following strcmp function...Ch. 12.2 - Prob. 12.7CPCh. 12.3 - Write a short description of each of the following...Ch. 12.3 - Write a statement that will convert the C-string...Ch. 12.3 - Prob. 12.10CP
Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Prob. 12.12CPCh. 12.4 - What is the output of the following program?...Ch. 12 - A(n)___________is represented in memory as an...Ch. 12 - The____________ statement is required before the...Ch. 12 - A(n)____________is written in your program as a...Ch. 12 - Prob. 4RQECh. 12 - The______________ is used to mark the end of a...Ch. 12 - Prob. 6RQECh. 12 - Prob. 7RQECh. 12 - Prob. 8RQECh. 12 - Prob. 9RQECh. 12 - Prob. 10RQECh. 12 - Prob. 11RQECh. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - Prob. 14RQECh. 12 - Prob. 15RQECh. 12 - Prob. 16RQECh. 12 - Prob. 17RQECh. 12 - Prob. 18RQECh. 12 - Write a function whose prototype is char...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #inc1ude iostream #inc1ude cstring using namespace...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #include iostream #inc1ude cstring using namespace...Ch. 12 - #include iostre4m #inc1ude cstring using namespace...Ch. 12 - Each of the following programs or program segments...Ch. 12 - Soft Skills 30. You are a member of a...Ch. 12 - Prob. 1PCCh. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Prob. 4PCCh. 12 - Name Arranger Write a program that asks for the...Ch. 12 - Prob. 6PCCh. 12 - Prob. 7PCCh. 12 - Prob. 8PCCh. 12 - Prob. 9PCCh. 12 - Password Verifier Imagine you are developing a...Ch. 12 - Prob. 11PCCh. 12 - Check Writer Write a program that displays a...Ch. 12 - Prob. 13PCCh. 12 - Dollar Amount Formatter Modify Program 12-13 by...Ch. 12 - Word Separator Write a program that accepts as...Ch. 12 - Prob. 16PCCh. 12 - I before e except after c A friend of yours who is...Ch. 12 - User Name Write a program that queries its...Ch. 12 - String Splitter Write a function vectorstring...Ch. 12 - Palindromic Numbers A palindromic number is a...
Knowledge Booster
Similar questions
- Write the countVowels function which counts the number of vowels using the string class as follows: int countVowels(const string& s) Write a test program that prompts the user to enter a string, invokes the countVowels function and displays the total number of vowels in the string.arrow_forwardProgramming language: SWIFT Write a function that takes a string as a parameter and returns the string "Swift" if the string passed as parameter begins with "SWIFT" or "swift". Otherwise, returns an empty string.arrow_forwardIn C language, Write a function that gets a string containing a positive integer. The function subtracts 1 fromthat integer and puts the obtained value in the string. void str_subtract_one(char* num); For example:- if before we call str_subtract_one(str) we have str==“1997”, then after return str will be “1996”.- if before we call str_subtract_one(str) we have str==“12345678987650”, then after return str will be “12345678987649”.- if before we call str_subtract_one(str) we have str==“100”, then after return str will be “99”. 1. You may assume that the input is always legal, i.e., the string is a positive integer correctly formatted.2. Note that the numbers may be larger than the maximum of int or long. That is, you should not try to convert string to intarrow_forward
- C++ languagearrow_forwardExercise #3: Character Counts Write a c++ program that prompts the user to enter a string, calls the function lowerUpperDigits( ) which takes a string and counts the number of lower, upper, and digit characters in the string. The main program prints the number of found characters. int lowerUpperDigits(string, int&, int&); Sample input / output:arrow_forwardCode must be in C++arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning