[ create a new paste ] login | about

Link: http://codepad.org/ncFr1HSH    [ raw code | output | fork ]

C, pasted on Aug 3:
#include <math.h> 

typedef struct { 
double x; 
double y; 
} orth_coord_t; 

typedef struct { 
double r; 
double theta; 
} polar_coord_t; 

orth_coord_t polar_to_orth(polar_coord_t p) 
{ 
orth_coord_t ret; 
ret.x = p.r * cos(p.theta); 
ret.y = p.r * sin(p.theta); 
return ret; 
} 

polar_coord_t orth_to_polar(orth_coord_t o) 
{ 
polar_coord_t ret; 
ret.r = sqrt(o.x * o.x + o.y * o.y); 
ret.theta = atan2(o.y, o.x); 
return ret; 
}


Output:
1
2
3
4
5
In function `_start':
undefined reference to `main'
In function `polar_to_orth':
undefined reference to `sin'
undefined reference to `cos'


Create a new paste based on this one


Comments: