>When I input zero for X, it moves on and ask for Y. Now, it's not suppose to do that. It's suppose to output an error message and asking me for a different input.
The get_input () has a logic flaw then.
It asks for X and then for Y, when it should ask only for either X or Y.
Edit:
Continuous loop:
Display question
if input entered
is x more than 0
return x
x is not more than 0
Display error and it will loop again
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
>but I'm a bit confused in understanding why it works like that. Why is only one of the variables, x or y, needed for it to work?
That's the way you designed. Functions can only return one value. And you are calling that function once for X and another time for Y in main.
>Also, how would I make it read decimal numbers, round it, and accept it? For example, 123.123 is entered, so 123 suppose to be read. I'm also trying to find out how to do this.
Read on .
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
Without code, I can not guess what kind of modification you had done.
For rounding up you can take a look at the ceil() function in the math.h as well.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218