- "why does he assign a function to a variable?"
He doesn't. This(note the brackets):
// vv
int x = ReadNumber();
assigns the returned value to x. The brackets mean, that the function is actually called - or the body is executed. That function has return x; at the end, so it returns the value of x which is assigned to x - the one in the main. Note that the x in main and x in ReadNumber are totally different.
Also, you can't assign function to a variable in C++ (you can use function pointers, but this is another thing)
- "What's the point in assigning int x, y to ReadNumber() ?"
The returned value from ReadNumber is a temp value and it should be stored somewhere. So, that's why x and y are defined in the main, so that each of them stores the value, returned from ReadNumber. And each of these values can be different.
If, in main, there were no x and y, the returned values are unusable and cannot be accessed at all. And they are destroyed.
- "Is it for storing return value of function in a variable? Or is this just a way to pass arguments?"
No any arguments here. Arguments are written inside the brackets ( () ) and here, there are no such when calling ReadNumber. So yes, they are for storing the returned values.
WriteAnswer does not have return at the and and it's defined as void - which means - no return value. That's why there's no such thing as
int x = WriteNumber( X + y )
But note, that here WriteNumber has argument. Just one, and it's the value of the calculated x + y. So, it's like:
int z = x + y;
WriteNumber( x );