//PRE: str[] contains a null-terminated string
//POST: The function returns the index of the first occuurrence of
// '.' in str[]. If str[] contains no '.', the function returns -1
int PositionOfPeriod (const char str[])
{
int i=0;
int position = -1; // return -1 if period not found
while (str[i] != '\0')
{
if (str[i] == '.')
return i;
i++;
}
return position;
}