OK, but I work without a sign, and this gives the correct answer(haven't check it yet but I think it is correct....)Code:#include <stdio.h> #include <stdlib.h> #include <math.h> #define pi 3.14159265 struct pos_s{ int x; int y; }; int main(){ float angle; struct pos_s pos; int i; scanf("%d", &pos.x); scanf("%d", &pos.y); printf("processeing...\n"); angle = ((atan2((0 + pos.y), (0 + pos.x)))*(180/pi)); printf("final angle:%f", angle); return 0; }
Compile this code and tell me what you think...