dimanche 16 décembre 2018

Calculating the distance between two random points in a C++ Battleship game

So, my problem is how to calculate the distance between the two random points (x,y) so i can use the abs method (as i was starting to do in the Function bool CheckColpo) and tell the player if his shot was actually in range of the enemy ship's position. How can you calculate the distance between two things that'll be random? How should i approach this? i know that i need to use the abs function AFTER i found the distance between the two points. I had a friend that was trying to explain it to me, but i guess i'm too thickheaded. I'm new to programming and C++ is the first language i'm learning, i hope someone can point out the way.

Here's my code : https://codeshare.io/5D6kxr

Thanks a lot , and if i made this post in a wrong way i'll take action to correct it right away.




Aucun commentaire:

Enregistrer un commentaire