Array Comparison

Im suppose to get the number of times my program compares the values inputed how to do i get that to happen and display the number?

#include <iostream>
using namespace std;

int searchList(const int [], int, int);
const int SIZE= 10;
char again;
int main()
{
int Lottery[SIZE] = {13579, 26791, 33445, 55555, 62483, 77777, 79422, 85647,
93121};
int winner, Lotto;

do
{
cout<<"Enter Lottery Number."<<endl;
cin>> Lotto;
winner = searchList(Lottery, SIZE, Lotto);
if (winner == -1)
cout<< "you did not win"<<endl;
else
{
cout<< "You won"<<endl;
cout<< "Compared " << (winner + 1) << " Times.\n";
}
cout<< "Run a different number? (Y/N)"<<endl;
cin>> again;
} while (again == 'Y' || again == 'y');
system ("pause");
return 0;
}
int searchList(const int list[], int numElems, int value)
{
int index=0;
int position = -1;
bool found = false;

while ( index < numElems && !found)
{
if (list[index] == value)
{
found= true;
position = index;
}
index++;
}
return position;
}
does anyone know how to do this
Topic archived. No new replies allowed.