Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Lab 1b 2. Create a program named lab1b_2.cpp which contains a function that returns the number of times that the string hi appears anywhere

C++

Lab 1b 2. Create a program named lab1b_2.cpp which contains a function that returns the number of times that the string "hi" appears anywhere in a 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 funciton, it would return a 2. Heres 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 0 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_2

Step: 3

blur-text-image_3

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

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago