Originally Posted by
GeorgeV
Here's the code I have, and note, this is a UK keyboard setup, so I couldn't work out the "hash" symbol.
The hash key is next to the return key in the middle row on a standard UK keyboard
Code:
float height (float x, float y)
{return x*(180/3.141593);
return y*(180/3.141593);
}
As nempo said, you can't return multiple values from a function, although since you're using C++, don't use pointers, use references, which will allow you to directly modify the values in-situ. eg,
Code:
void height (float & x, float & y)
{
x = x *(180/3.141593);
y = y *(180/3.141593);
}
you could also investigate the struct keyword which will allow you to create your own type to combine X and Y together.
Code:
struct coordinate
{
double x, y;
};
/* ... */
coordinate to_degrees( double x, double y )
{
coordinate coo;
coo.x = x *(180/3.141593);
coo.y = y *(180/3.141593);
return coo;
}
(By the way, I reccommend using double's instead of float's - the double type has a much greater precision. the typical precision of float is around 6 significant figures on most modern desktops)