Hello, I am trying to count the number of times that "Ni" occurs in the string "Ni nI NI nI Ni". However, I can't get my code to work. Any help that I could get as soon as possible would be wonderful. Keep in mind that I need to keep the class MyClass, and the getNiCount function within the public section of that class. Also, I need to have const char *szTestString1 = "Ni nI NI nI Ni"; in my main function.
// classes example
#include <iostream>
using namespace std;
class MyClass {
public:
int getNiCount(const char *phrase)
{
int index = 0;
int num_occurences = 0;