Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started