Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- float distance_calc(float loc_one_x, float loc_one_y, float loc_two_x, float loc_two_y, float distance_between_loc)
- {
- printf("Coordinates of one are (%.0f, ", loc_one_x);
- printf("%.0f)\n", loc_one_y);
- printf("Coordinates of two are (%.0f, ", loc_two_x);
- printf("%.0f)\n", loc_two_y);
- 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)));
- return(distance_between_loc);
- }
- int main()
- {
- float loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc, total_distance;
- loc_one_x = 4;
- loc_one_y = 5;
- loc_two_x = 2;
- loc_two_y = 3;
- distance_between_loc = distance_calc(loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc);
- printf("distance_between_loc is %f\n", distance_between_loc);
- /*do
- {
- distance_between_loc = distance_calc(loc_one_x, loc_one_y, loc_two_x, loc_two_y, distance_between_loc);
- printf("distance_between_loc is %f\n", distance_between_loc);
- total_distance = total_distance+distance_between_loc
- }while();*/
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement