Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  point
Language: C/C++
Code:
#include <stdio.h>
#include <math.h>
#define M_PI   3.14159265358979323846264338327950288

int main(int argc, char *argv[])
{
     float x, y, d, a;
     printf("X: ");
     scanf("%f", &x);
     printf("Y: ");
     scanf("%f", &y);
     printf("Distance: ");
     scanf("%f", &d);
     printf("Angle: ");
     scanf("%f", &a);
     a = a * M_PI / 180.0;

     printf("X: %.2f\n", x + sin(a) * d);
     printf("Y: %.2f\n", y + cos(a) * d);
     
     return 0;
}
          
          
          
          
          
          
Comments: