A line like this if (counter = 0)
will set counter to zero, not test if it's zero. You need to use if (counter == 0)
instead.
A more general comment is that you should never have this much repeated source code - you could use a loop to get rid of all those blank line cout
s, then have another loop to generate the spacing to move the car sideways.