In the code below, the method getLowerLimit outputs the prompt but does not wait for user input. I can't figure out why it's doing this since I've done the same procedure in previous code without a problem.
Wait, this program compiles? It shouldn't and it does not for me. getLowerLimit as well as getUppetLimit are both integer functions, meaning they must return an integer.
Im not sure what you want to do with the program but my guess is that, you want to return both xHigh and xLow, and then "catch" them from main.
return xHigh;
int highCatcher = test.getUpperLimit();
You can do the same with getLowerLimit. Then you can (Im guessing) do an if statement in main which determines whether or not all tests are passed.
All this program is meant to do so far is take an input for xHigh and xLow. But xLow is not waiting for user input. There's going to be more to it but that's all I want it to do so far.
Well, if you're not going to listen to what I just wrote. Then that means your two functions should not be of integer. make them void functions, and it should work fine.
I don't think you're understanding my problem. I know what to do because I've done it in the past. I cout a prompt for user input. I take the user's input and pass it into a variable. The problem I'm having is that after the first prompt and input for xHigh, the program does not wait for any more input.
> I know what to do because I've done it in the past.
Are you sure about that? Becuase Im not. as Ive said before, your INTEGER functions has to return an INTEGER, period. I did that with your program, and everything worked like a charm. I also tried what other thing I suggested, using VOID functions instead of int, also worked perfectly fine. If you're not willing to listen then dont ask in the first place.
P.s. Yes, working like a charm and worked perfectly fine does mean that the program waits and asks for the lower limit after the higher one.
After fixing the code to have those functions actually return something, the program behaves exactly how I would expect it to (both input prompts work fine).
When it doesn't work for you, what input are you giving it?
I'm going under the assumption that his compiler is allowing that code to compile but it still is not behaving as he expects.
And yes, I agree his code is working fine. But for him it isn't, which is why I'm asking about the input he's providing. If he's giving invalid input it might cause behavior he's seeing.
@Disch I figured out the problem. I was entering values with decimals such as 2.5 and passing them into a variable of type int. I didn't see my mistake at first but realized that I may be entering invalid input. After changing the variables to type float it worked. Thank you for your help.