0

I need help with my distance formula. pow is apparently not in cmath or math.h. Since I am a beginner in C++, I need some help with the distance. I did the floaters and everything, well I used a book. Beginning Math and Physics for Game Programmers by Wendy Stahler. I just dont get how to make the distance work. can anyone help me??

Thank You for your help guys. It means a lot to me. =)

```
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <Windows.h>
using namespace std;
int main()
{
int car1[3]; //Car 1 has 3 coordinates
int car2[3]; //Car 2 has 3 coordinates
// Car 1's ( X, Y, Z ) Coordinates
cout << "What is the X Coordinate of Car 1? ";
cin >> car1[0];
cout << endl;
cout << "What is the Y Coordinate of Car 1? ";
cin >> car1[1];
cout << endl;
cout << "What is the Z Coordinate of Car 1? ";
cin >> car1[2];
cout << endl;
cout << "The coordinates of Car 1 are..." << " ( " << car1[0] << "," << car1[1] << "," << car1[2] << " )" << endl;
cout << endl;
// Car 2's ( X, Y, Z ) Coordinates
cout << "What is the X Coordinate of Car 2? ";
cin >> car2[0];
cout << endl;
cout << "What is the Y Coordinate of Car 2? ";
cin >> car2[1];
cout << endl;
cout << "What is the Z Coordinate of Car 2? ";
cin >> car2[2];
cout << endl;
cout << "The coordinates of Car 2 are..." << " ( " << car2[0] << "," << car2[1] << "," << car2[2] << " )" << endl;
cout << endl;
cout << "The Midpoint of Car's 1 and 2 is.... " << "( " << (car1[0] + car2[0]) /2 << ", " << (car1[1] + car2[1]) / 2 << ", " << (car1[2] + car2[2]) / 2 << " )" << endl;
cout << endl;
float DistanceofTwoCars(float *car1, float *car2);
{
cout << "The Distance between Car 1 and Car 2 is... " << endl;
cout << endl;
cout << "D = " << (float)sqrt(pow(car2[0] - car1[0], 2) + pow(car2[1] - car1[1], 2) + pow(car2[2] - car1[2], 2)) << endl;
};
system("pause");
return 0;
}
```