私はC++を初めて使用し、この関数を理解するのに苦労しています。誰かが私にそれを教えてもらえますか?
int seqSearch(int [ ] list, int target)
{
//precondition: The list is in non-decreasing order
//postcondition: The method returns -1 if the target is not in the list. If the target
//is in the list, the method returns the index of the first occurrence of the target.
int result = -1;
boolean foundBigger = false;
int i = 0;
while (result == -1 && !foundBigger && i < list.length)
{
if (target == list[i])
result = i;
else if (list[i] > target)
foundBigger = true;
//endif
i++;
} //endwhile
return result;
}