You may not be doing anything wrong. As I recall (it's been more than a year), when you run the program (manually or with input from generate), it will always print out a prompt for "haystack[i]= ". When manually run, it will wait for you to input a number. When run against generate, it will print out all of the prompts without waiting, as you are seeing. If generate is spitting out a thousand numbers, it will print what you are seeing.
The important thing is that it is saying Found needle only once if it is there and needle not found if it is not there. Have you run it against check50? If check50 is happy, just smile and move on to coding for a binary search. ;-)
[EDIT: added comments]
As for returning true, there's at least one problem - the for loop test condition. It checks for
value < n. I'm surprised that this doesn't generate an infinite loop or a seg fault. With this test, it will either fail immediately, or will run past the end of the array because value and n don't change (effectively always true or always false). The only thing that might change this is if random data happens to equal content of
value at some point, returning a true. Otherwise, it is more likely to seg fault when it exceeds memory bounds.
Perhaps you meant to have
i < n? It's also possible that the code that you're compiling doesn't match what was posted, which could have entirely different results.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)