Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello needs to contain a function that returns the number of times that the string hi appears anywhere in a given string. for example ifABChi

hello

needs to contain a function that returns the number of times that the string "hi" appears anywhere in a given string. for example if"ABChi hi" was passed in, it would return a 2.

o

image text in transcribed

2. Create a program named lab2_2.cpp which contains a function that returns the number of times that the string "hi" appears anywh given string. For example, if "abc hi ho" was passed in, it would return a 1. If "ABChi hi" was passed in, it would return a 2. If "hihi" was passed into the function, it would return a 2. Here's the prototype: int countHi(string str); Create a driver (a main file) which asks the user for a string, and then print the number of times "hi" appears in that string. Example: Enter a string: how is everyone? hi appears a times. Example: Enter a string: The hint is to be nice and say hi. hi appears 2 times

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

Cost Accounting A Managerial Emphasis

Authors: Charles T. Horngren, Srikant M.Dater, George Foster, Madhav

13th Edition

8120335643, 136126634, 978-0136126638

Students also viewed these Databases questions