C语言有关字符数组的问题

输入一串字符到数组中,再输入一个字符,将字符串中与此字符相同的字符删除,并统计被删除字符的个数。

#include <iostream>
#include <string>
using namespace std;
 
int deleteChar(char *s , char c);
 
int main()
{
    char a[] = "Hello world! Hello world! Hello world!";
    cout << a << endl << endl;
    char b;
    cout << "Enter the delete char:\n";
    cin >> b;
 
    int num = deleteChar(a, b);
    cout << a << endl;
    cout << "The number of deleted characters:\n";
    cout << "num = " << num << endl;
 
    return 0;
}
 
int deleteChar(char *s , char c)    //删除字符串中指定的字符
{
  if(NULL == s)
  {
    cout << "The current pointer is empty!" << endl;
    return 0;
  }
  else
  {
    char *f = s;
    int i = 0, j = 0;
    while(*s)
    {
      i++;
      if (*s != c)        // 如果不是指定的字符就复制
      {
          j++;
          *f = *s;
          f++;
      }
      s++;
    }
    *f = '\0' ;      //封闭字符串
    if(i == j)
      cout << "There are no characters to delete in the string!" << endl;
    return i-j;      //返回删除的字符个数
  }
}