The “count” variable has it’s scope only within the “for” loop. That loop terminates with the ‘}’ character at the end of line.
The count you are referencing on your cout line is from somewhere else. I assume that somewhere in global scope you’re pulling in definitions of two “count” functions and the compiler thinks you want to refernce one of those, but doesn’t know which one to take.
1
solved Why is the compiler throwing me the error function overload? [closed]