1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/* This program is a distance calulator for arma 2/DayZ */
#include "stdafx.h"
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
int x1, y1;
int x2, y2;
int x1k, y1k;
int x2k, y2k;
int km;
int ad;
cout << "Choose Unit of Measure 1=Km, 2=M ", cin >> km;
if (km == 1) {
cout << "You've Chosen Kilometers." << endl;
cout << "Enter X1 = ", cin >> x1k;
cout << "Enter Y1 = ", cin >> y1k;
cout << "Enter X2 = ", cin >> x2k;
cout << "Enter Y2 = ", cin >> y2k;
cout << "Distance From (" << x1k << ", " << y1k << ") to (" << x2k << ", " << y2k << ") = " << (sqrt(pow(((x2k - x1k)/2.00), 2.00) + pow(((y2k - y1k)/2.00), 2)))/5.00 << "km" << endl;
system ("PAUSE");
} else {
cout << "You've Chosen Meters." << endl;
cout << "Enter X1 = ", cin >> x1;
cout << "Enter Y1 = ", cin >> y1;
cout << "Enter X2 = ", cin >> x2;
cout << "Enter Y2 = ", cin >> y2;
cout << "Distance From (" << x1 << ", " << y1 << ") to (" << x2 << ", " << y2 << ") = " << ((sqrt(pow(((x2 - x1)/2.00), 2.00) + pow(((y2 - y1)/2.00), 2.00)))/5.00)*1000.00 << "m" <<endl;
system ("PAUSE");
}
cout << "Would you like to find another distance? (1=Yes, 2=No) ", cin >> ad;
if (ad == 1) {
}
return 0;
}
|