On line 6. you declare a variable called guess.
On line 11, you compare a value against the value of guess.
But nowhere did you give guess a proper value before line 11. Your program is technically undefined behavior because you are using the value of a variable that is uninitialized.
Just give it an initial value that doesn't equal secretNum, like 0. int guess = 0;