Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the testPIN function used in Program 7-21. For convenience, we have rep

ID: 3647855 • Letter: C

Question

Consider the testPIN function used in Program 7-21. For convenience, we have reproduced the code for you below:

bool testPIN(int custPIN[], int databasePIN[], int size) {
for (int index = 0; index < size; index++) {
if (custPIN[index] != databasePIN[index])
return false; // We've found two different values.
}
return true; // If we make it this far, the values are the same.
}

Modify this function as follows:
change its type to int
change its name to countMATCHES
make it return the number of corresponding parallel elements that are equal

Explanation / Answer

int countMATCHES(int custPIN[], int databasePIN[], int size) { int count=0; for (int index = 0; index