The test you have where you test the remainder is "not equal to zero" doesn't work. The usual problem is that you need every remainder to be non-zero. In your code, you filter the result so you are not checking all of them, only the case where counter = n/2, in other words you verify that it isn't divisible by 2.
You need to check that number cannot be exactly divided by any integer. So, if the remainder number%counter is equal to zero, the number is not prime. You could test that condition, if it's true, exit (return) from the function.
When the for-loop makes it all the way through to the end, you will know the number is prime. So put the cout statement after the end of the for loop.