You're asking the program to increment a variable named counter. However, nowhere in your code do you declare it. You've declared four doubles (density, viscosity, diameter and speed) but you haven't declared counter, which should be an integer.
It'll also need to be initialised once declared, otherwise your loop will go nuts.