Question: I have one c++ coding question, please help me complete it thank you so much my angel In the following program, implement two functions, named

I have one c++ coding question, please help me complete it thank you so much my angel

In the following program, implement two functions, named searchACharacter, to count the number of characters in a string using the following parameters: A Cstring to be searched, a character to be searched for, and the count argument to pass back the counting result.

The signature for the two overloaded functions is provided. Assume that your implementation will be inserted at TODO

#include

using namespace std;

void searchACharacter(char[], char, int&);

void searchACharacter(char[], char, int*);

int main()

{

char str[] = "A quick brown fox jumps over the lazy dog.";

char ch = 'o';

int count = 0, count1 = 0;

int* count_ptr = &count1;

searchACharacter(str, ch, count);

cout << "Number of occurances of the character \'" << ch

<< "\' in the string " << endl;

cout << "\"" << str << "\"" << endl;

cout << "is: " << count << endl;

searchACharacter(str, ch, count_ptr);

cout << "Number of occurances of the character \'" << ch

<< "\' in the string " << endl;

cout << "\"" << str << "\"" << endl;

cout << "is: " << *count_ptr << endl;

}

// TODO-1: write definition of the function searchACharacter with

// parameters char [], char, and int&

// TODO-2: write definition of the function searchACharacter with

// parameters char [], char, and int*

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!