int MailBoxes::boxIndex(int box) //postcondition: returns the index of the element in myBoxes // whose POBox field equals box if there is such an element; // otherwise, returns -1. { int k = 0; while (k < myBoxCount && myBoxes[k].POBox != box) { k++; } if (k < myBoxCount) return k; // found box else return -1; // box not found }