Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. float distance_calc(float loc_one_x, float loc_one_y, float loc_two_x, float loc_two_y, float distance_between_loc)
  5. {
  6.     printf("Coordinates of one are (%.0f, ", loc_one_x);
  7.     printf("%.0f)\n", loc_one_y);
  8.     printf("Coordinates of two are (%.0f, ", loc_two_x);
  9.     printf("%.0f)\n", loc_two_y);
  10.     distance_between_loc = sqrt(((loc_two_x-loc_one_x)*(loc_two_x-loc_one_x))+((loc_two_y-loc_one_y)*(loc_two_y-loc_one_y)));
  11.     return(distance_between_loc);
  12. }
  13.  
  14. int main()
  15. {
  16.     float loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc, total_distance;
  17.     loc_one_x = 4;
  18.     loc_one_y = 5;
  19.     loc_two_x = 2;
  20.     loc_two_y = 3;
  21.     distance_between_loc = distance_calc(loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc);
  22.     printf("distance_between_loc is %f\n",  distance_between_loc);
  23.     /*do
  24.     {
  25.         distance_between_loc = distance_calc(loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc);
  26.         printf("distance_between_loc is %f\n",  distance_between_loc);
  27.         total_distance = total_distance+distance_between_loc
  28.     }while();*/
  29.     return(0);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement