Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: The find function for strings only returns the first instance of a character or a word. In this lab, you will create your own

image text in transcribed
Objective: The find function for strings only returns the first instance of a character or a word. In this lab, you will create your own approach to return all instances of a character or a word in a string. Write a program called lab5.cpp which can allow the user to find all instances of a character or a word in a string. For this lab, you can use the following string in your program std: string mystr "the quick brown fox jumped right over the lazy dog."; Your program should prompt the user to enter a character or a phrase and print to the screen the positions of the character or word within the string. If the character or phrase was not found, your program should print to the screen the message Not found To submit your program use the following: Your output should look like the example shown below bash-4.1$ ./stringfind Enter a character or a word: t 0,31,38, bash-4.1$ ./stringfind Enter a character or a word: the 0,38, -bash-4.1s ./stringfind Enter a character or a word: hello Not found bash-4.1S Figure 1 - Multifind program showing the program returning positions of a character or a word within the string, and a message Not found if it cannot find it

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago