Loop printing out results twice
Not sure why im not seeing the problem here but this for loop continues to
print out vector results twice. Yet the value at count is always coming
back correct. Thanks again
int Summary :: Search()
{
int count = 0;
for (int i = 0; i < dataOffenseName.size(); i++)
{
if ( OffenseName == dataOffenseName[i] && Down == dataDown[i])
{
if (YardToGo == dataYardToGo[i] || YardToGo + 1 == dataYardToGo[i]
|| YardToGo - 1 == dataYardToGo[i])
{
if (Location == dataNextYardLocation[i] ||
Location > dataNextYardLocation[i] -
getRange(dataNextYardLocation[i]) &&
Location < dataNextYardLocation[i] +
getRange(dataNextYardLocation[i]))
{
cout << "Line Number: " << i;
count++;
printResults(dataOffenseName[i], dataDown[i],
dataYardToGo[i] , dataNextYardLocation[i]);
}
}
}
}
return count;
}
void Summary :: printResults(string printOffenseName, int printDown, int
printYardToGo, int printLocation)
{
cout << "\nOffense Name: " << printOffenseName <<endl;
cout << "Down: " << printDown <<endl;
cout << "Yards To Go For Next Down: " << printYardToGo <<endl;
cout << "Starting Location For Next Down: " <<printLocation <<endl
<<endl;
}
No comments:
Post a Comment