Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Heading(int Jstick, int x, int y, int *hX, int *hY){
- if(y > Jstick/2+2){
- *hY = 1;
- }else if(y < Jstick/2-2){
- *hY = -1;
- }else{
- *hY = 0;
- }
- if(x > Jstick/2+2){
- *hX = 1;
- }else if(x < Jstick/2-2){
- *hX = -1;
- }else{
- *hX = 0;
- }
- }
- int main()
- {
- int Jstick = 4095;
- double div = Jstick/200.0;
- int x, y;
- int hX, hY;
- while(1){
- scanf("%d %d", &x, &y);
- x = (x-Jstick/2)/div;
- y = (y-Jstick/2)/div;
- Heading(Jstick, x, y, &hX, &hY);
- printf("\nx is %d\ny is %d", x, y);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement