My Array is Not Incrementing

Hello all, long story short, the function below is not incrementing my array, please advise whats wrong with it

//---------------------------------------------------------------------
void UpdateParking()
{
cout << "Please enter a valid plate number -> ";
long your_plate;
cin >> your_plate;

for (int i = 0; i < size; i++)
{
if ( your_plate == Plates[i])
ParkingTickets[i] = ParkingTickets[i] + 1;
}
}
//---------------------------------------------------------------------
I don't see any syntax errors. Are you sure the condition of the 'if' statement evaluates to true for some 'i'?
Possibilities (if Plates is vector<long>):
1. you want Plates.size() in your for loop
2. Plates.size() is 0 or is simply hasn't been initialized

If Plates is an array, you need to make sure size is initialized properly (probably want non-zero).
Last edited on
Topic archived. No new replies allowed.