Here's a sample of pseudo code for some program:
begin loop
ask user for input
read input
test that input is valid
if not valid go to top of loop and ask again
process input
add input to list...
Type: Posts; User: Norm
Here's a sample of pseudo code for some program:
begin loop
ask user for input
read input
test that input is valid
if not valid go to top of loop and ask again
process input
add input to list...
Please read my last post, we crossed.
Use an if statement to test the value entered against the preset value and if equal, use the break statement to exit the loop.
The order of the statements in the program do not make any sense....
The middle number would be found by some formula like: (the count of numbers entered+1/2) with a test if there are an even count and then there would be two middle numbers.
An example: with 6...
Still not clear what you are trying to do with an array. Given an array, by your definition, the middle can be found from the length of the array.
Where do the guessed numbers get involved?
Can...
Not sure what those mean. The "middle" number(s) is a function of the size of the array. There is no need for guessed numbers to find it.
Which is the middle element in an array with an even number of elements?
Your example is an array with an odd number of elements. What if there are an even number?
Is the middle element = (array.length+1)/2
Or are you talking the the value of the element?
Can you define what a "middle number" is? Perhaps give an example.