24 lines
570 B
C
24 lines
570 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
struct Vec2d {
|
|
double x;
|
|
double y;
|
|
};
|
|
|
|
struct Vec2d getCoords(double Winkel) {
|
|
struct Vec2d erg;
|
|
erg.x = cos(Winkel);
|
|
erg.y = sin(Winkel);
|
|
return erg;
|
|
}
|
|
|
|
int main() {
|
|
double winkel[] = {0.0,45.0,90.0,135.0,180.0,360.0};
|
|
int max = sizeof(winkel)/sizeof(double);
|
|
for(int i=0;i < max;i++){
|
|
double winkel_rad=(winkel[i] * (0.0174533)); // double at end represents est of 1 degree in radian
|
|
struct Vec2d erg = getCoords(winkel_rad);
|
|
printf("Pos of %lf is x=%lf and y=%lf \n",winkel[i],erg.x,erg.y);
|
|
}
|
|
} |