M...
POST WHORING SNUBIE THREAD
Collapse
X
-
Open Source Crow.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double earthRad = 6371;
double startLat;
double startLon;
cout << "Please enter the latitude and longitude of your starting position (in decimal degrees) ";
cin >> startLat >> startLon;
double endLat;
double endLon;
cout << "Please enter the latitude and longitude of your end position (in decimal degrees) ";
cin >> endLat >> endLon;
double dLat = endLat - startLat;
double dLon = endLon - startLon;
const double pi = 3.1415;
double dLatRadies = dLat * (pi / 180);
double dLonRadies = dLon * (pi / 180);
double distanceKm;
double distanceMi;
double b = ( pow(sin(dLonRadies / 2), 2.0) ) * cos(startLat * pi / 180) * cos(endLat * pi / 180);
double a = ( pow(sin(dLatRadies / 2), 2.0) ) + b;
double c = 2 * atan2( sqrt(a), sqrt(1 - a) );
distanceKm = earthRad * c;
distanceMi = distanceKm / 1.6;
cout << "Your input coordinates were " << startLat << ", " << startLon << " (start)" << endl;
cout << "Your input coordinates were " << endLat << ", " << endLon << " (end)\n" << endl;
cout << "The distance between these two points in kilometres is " << distanceKm << endl;
cout << "The distance converted to miles is " << distanceMi << endl;
cin.ignore();
cin.get();
return 0;
}Words of Wisdom
Premium Parrots: only if the carpet matches the drapes.
Crow: Of course, that's a given.
Crow: Imagine a jet black 'raven' with a red bush?
Crow: Hmm... You know, that actually sounds intriguing to me.
Premium Parrots: sounds like a freak to mePremium Parrots: remember DO NOT TURN YOUR BACK ON CROW
Premium Parrots: not that it would hurt one bit if he nailed you with his little pecker.Frosted: lucky twat
Frosted: Aussie slags
Frosted: Mind the STDs Crow
Comment
-
-
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double tempF;
cout << "Please enter the temperature (in Fahrenheit) ";
cin >> tempF;
double windM;
cout << "Please enter the wind speed (in miles per hour) ";
cin >> windM;
double windChill = ( 35.74 + 0.6215 * tempF - 35.75 * pow(windM, 0.16) + (0.4275 * tempF) * pow(windM, 0.16) );
cout << "The current temperature (with wind chill factored) is " << windChill << endl;
cin.get();
cin.get();
return 0;
}Words of Wisdom
Premium Parrots: only if the carpet matches the drapes.
Crow: Of course, that's a given.
Crow: Imagine a jet black 'raven' with a red bush?
Crow: Hmm... You know, that actually sounds intriguing to me.
Premium Parrots: sounds like a freak to mePremium Parrots: remember DO NOT TURN YOUR BACK ON CROW
Premium Parrots: not that it would hurt one bit if he nailed you with his little pecker.Frosted: lucky twat
Frosted: Aussie slags
Frosted: Mind the STDs Crow
Comment
-
Comment