Homework/HW01/MyArray.cc
int MyArray::hamming(MyArray &data) const
{
    //Declare a variable to hold the Hamming distance counter and set it to 0.
    int hammingDistance = 0;

    //Declare variables to hold object-independent sizes.
    int smallerArraySize = (size < data.size ? size : data.size);
    int largerArraySize = (size > data.size ? size : data.size);

    //Cycle through the arrays and increment the Hamming distance counter when appropriate.
    for (int i = 0; i < smallerArraySize; ++i)
        if (array[i] != data.array[i])
            ++hammingDistance;

    //Return the Hamming distance counter plus the difference in array sizes.
    return hammingDistance + largerArraySize - smallerArraySize;
}
/****************************** hamming ************************************************************
Action:         Computes the Hamming distance between two MyArray objects.

Parameters:
IN:             MyArray &data, contains a reference to the MyArray object for which the Hamming
                distance is being computed against.
OUT:            None

Returns:        int representing the computed Hamming distance.

Precondition:   None
***************************************************************************************************/
hamming
Action:         Computes the Hamming distance between two MyArray objects.

MyArray &data, contains a reference to the MyArray object for which the Hamming
distance is being computed against.
OUT:            None

int representing the computed Hamming distance.

None
hamming Action : Computes the Hamming distance between two MyArray objects . MyArray &data contains a reference to the MyArray object for which the Hamming distance is being computed against . OUT : None int representing the computed Hamming distance . None
int MyArray::hamming(MyArray &data) const
{
    int hammingDistance = 0;
    int smallerArraySize = (size < data.size ? size : data.size);
    int largerArraySize = (size > data.size ? size : data.size);
    for (int i = 0; i < smallerArraySize; ++i)
        if (array[i] != data.array[i])
            ++hammingDistance;
    return hammingDistance + largerArraySize - smallerArraySize;
}
int MyArray :: hamming ( MyArray & data ) const { int hammingDistance = 0 ; int smallerArraySize = ( size < data . size ? size : data . size ) ; int largerArraySize = ( size > data . size ? size : data . size ) ; for ( int i = 0 ; i < smallerArraySize ; ++ i ) if ( array [ i ] != data . array [ i ] ) ++ hammingDistance ; return hammingDistance + largerArraySize - smallerArraySize ; }
hamming
Action:         Computes the Hamming distance between two MyArray objects.
hamming Action : Computes the Hamming distance between two MyArray objects .
//Declare a variable to hold the Hamming distance counter and set it to 0. //Declare variables to hold object-independent sizes. //Cycle through the arrays and increment the Hamming distance counter when appropriate. //Return the Hamming distance counter plus the difference in array sizes.