Results 1 to 10 of 10
Thread: C++ -
Hybrid View
-
22nd June 2006 10:34 #1Registered User
Join Date: Jun:2006
Location: Bulgaria
Posts: 10
-
22nd June 2006 10:58 #2
, , ,
Dell U2715H|Logitech Z-5500|Toshiba 55L7453|HP Envy Spectre XT|Sony MDR-1R|Fuji X-E2|Nexus 6P
-
22nd June 2006 18:22 #3Registered User
Join Date: Jun:2006
Location: Bulgaria
Posts: 10
:
1) =180˚+arctg( tg(a-B) / sinC)
2) Ae= atctg( cosC.cos(A-B)-0,1513) / (1-[cosC.cos(A-B)] kato tova cosC.cos(A-B) e na kvadrat a (1-[cosC.cos(A-B)] e pod koren
( )
. .
-
22nd June 2006 18:55 #4
Join Date: Feb:2005
Location: somewhere
Posts: 141
. double ?
Originally Posted by babayaga1983
, ***
-
22nd June 2006 19:58 #5
, math.h, , , ... - cos sin , , , sqrt . !
Dell U2715H|Logitech Z-5500|Toshiba 55L7453|HP Envy Spectre XT|Sony MDR-1R|Fuji X-E2|Nexus 6P
-
22nd June 2006 21:08 #6
EDIT: . .
... - EXCEL, - .
, .
Longitude (A) = 40
Longitude (B) = 30
Longitude (C) = 60
Results:
Aa = 191.508393
Ae = 7.31099637#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
const double M_ALPHA = 0.1513; // What's the actual name of this constant?
const double PI = 3.14159265358979323846;
const int ERROR_CALCULATION = -1;
using namespace std;
// This function converts decimal degrees to radians.
double deg2rad( const double deg )
{
return ( ( deg * PI ) / 180 );
}
// This function converts radians to decimal degrees.
double rad2deg( const double rad )
{
return ( ( rad * 180 ) / PI );
}
// This function calculates X' square.
double sqr( const double fX )
{
return ( fX * fX );
}
double calculateAa( const double fA, const double fB, const double fC )
{
if( 0 == fC )
{
cerr << "\n\nError occured while calculating Aa: Latitude C must be different from 0 degrees.\n\n";
exit( ERROR_CALCULATION );
}
return ( PI + atan( tan( fA - fB ) / sin( fC ) ) );
}
double calculateAe( const double fA, const double fB, const double fC )
{
double fTheta = fA - fB;
double fX = atan( sqr( cos( fC ) * cos( fTheta ) ) - M_ALPHA );
double fY = sqrt( ( 1 - ( cos( fC ) * cos( fTheta ) ) ) );
if( 0 == fY )
{
cerr << "\n\nError occured when calculating Ae: Division by zero was attempted.\n\n";
exit( ERROR_CALCULATION );
}
return ( fX / fY );
}
// This function reads longitude value from the user, verifies it and converts it in radians.
double readLongitude( const char* strDesc )
{
double fInput;
bool bValid = false;
while( !bValid )
{
cout << "Longitude (" << strDesc << ") = ";
cin >> fInput;
if( fInput < -90 || 90 < fInput )
{
cerr << "Longitude is not valid (must be within [-90,90]).\n\n";
}
else
{
bValid = true;
}
}
return deg2rad( fInput );
}
int main( int argc, char* argv[] )
{
double fA;
double fB;
double fC;
double fAa;
double fAe;
fA = readLongitude( "A" );
fB = readLongitude( "B" );
fC = readLongitude( "C" );
fAa = calculateAa( fA, fB, fC );
fAe = calculateAe( fA, fB, fC );
cout << "\n\nResults: \n";
cout.precision( 9 );
cout << "Aa = " << rad2deg( fAa ) << "\n";
cout << "Ae = " << rad2deg( fAe ) << "\n\n";
return 0;
}Last edited by cvetomirconev; 23rd June 2006 at 19:50.
Byte my shiney metl ss!
-
22nd June 2006 21:41 #7Registered User
Join Date: Jun:2006
Location: Bulgaria
Posts: 10
( )
-
22nd June 2006 21:46 #8
cvetomirconev, . - iostream.h. - exit() stdlib.h ?
- math.h M_PI . PI, .
, 0, ? , cvetomirconev , .Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19
-
22nd June 2006 22:19 #9, . <iostream.h> header, <iostream> . 2006-, Borland C++ 3.1 .
Originally Posted by 4eRNoBiL
Last edited by Pesho; 22nd June 2006 at 22:20.
-
23rd June 2006 13:39 #10
0- . .
, .
PI , C# MSDN-, , .
<stdlib.h> , .
EDIT: , M_PI math.h / cmath . .Last edited by cvetomirconev; 23rd June 2006 at 13:51.
Byte my shiney metl ss!




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in