// changetob.cxx  Changes every occurrence of the letter 's' to
//                the letter 'b' in a string

#include <iostream>

using namespace std;

void ChangeToB(char msg[]);

int main()
{
  char message[] = "say it again, sam";

  ChangeToB(message);

  cout << message << endl;

  return 0;
}

//PRE:  msg[] contains a null-terminated string
//POST: each occurrence of the letter 's' in msg has been changed to 'b'

void ChangeToB(char msg[])
{
  int i=0;

  while (msg[i] != '\0')
  {
     if (msg[i] == 's')
         msg[i] = 'b';
     i++;
  }
}

