title: Count String in a String Using Datatype Char
body: <p>Good day everyone! I have the codes for such a problem where, to create a program that counts how many times the second string appears on the first string. Yes it counts if you put 1 letter only, but if you put 2, it is an error. As an example. If the first string is Harry Partear, and the second string is ar, it must count as 3. Here's the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  using namespace std;
  int main ()
  {
  char first [100], second;
  int count;
  
  cout &lt;&lt;"Enter 1st String: ";
  cin.get (first, 100);
  
  cout &lt;&lt;"Enter 2nd String: ";
  cin &gt;&gt; second;
  
  for (int i = 0; i &lt; strlen (first); i++)
  {
      if (tolower(first[i]) == tolower(second))
      {
                            count++;
                            }
                            }
  
  
  cout &lt;&lt; "THE STRING " &lt;&lt; "'" &lt;&lt; second &lt;&lt; "'" &lt;&lt; " appeared " &lt;&lt; count 
  &lt;&lt; " times in "     &lt;&lt; first &lt;&lt; ".";
  
  getch ();
  return 0;
  }
  </code></pre>
  
  <p>Hope anyone can help me. :(</p>