I am trying to define a function in c++,

I wrote it in main function.

I am getting an error : a function-definition is not allowed here before ‘{’ token}I have defined it as following :

```
float distance(float x, float y, float pitch)
{
float r; //local variable
r = sqrt(x * x + y * y);
Bangle = arctan2(pitch*(y/r) + x , pitch*(x/r) -y);
return (cos(Bangle),sin(Bangle));
}
```

I dont know what dose this means. Any sugestion