>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.