Results 1 to 10 of 10

Thread: C++ -

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jun:2006
    Location: Bulgaria
    Posts: 10

    C++ -

    . ++ ( )
    3 . e-mail : watsupbg@yahoo.com

  2. #2
    Registered Abuser Vanu's Avatar
    Join Date: Sep:2003
    Location: ...
    Posts: 9,777
    , , ,
    Dell U2715H|Logitech Z-5500|Toshiba 55L7453|HP Envy Spectre XT|Sony MDR-1R|Fuji X-E2|Nexus 6P

  3. #3
    Registered 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

    ( )

    . .

  4. #4

    Join Date: Feb:2005
    Location: somewhere
    Posts: 141
    Quote Originally Posted by babayaga1983
    :
    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

    ( )

    . .
    . double ?
    , ***

  5. #5
    Registered Abuser Vanu's Avatar
    Join Date: Sep:2003
    Location: ...
    Posts: 9,777
    , math.h, , , ... - cos sin , , , sqrt . !
    Dell U2715H|Logitech Z-5500|Toshiba 55L7453|HP Envy Spectre XT|Sony MDR-1R|Fuji X-E2|Nexus 6P

  6. #6
    Registered User cvetomirconev's Avatar
    Join Date: Apr:2006
    Location: Sevlievo
    Posts: 175
    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!

  7. #7
    Registered User
    Join Date: Jun:2006
    Location: Bulgaria
    Posts: 10
    ( )

  8. #8
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    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

  9. #9
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    Quote Originally Posted by 4eRNoBiL
    cvetomirconev, . - iostream.h.
    , . <iostream.h> header, <iostream> . 2006-, Borland C++ 3.1 .
    Last edited by Pesho; 22nd June 2006 at 22:20.

  10. #10
    Registered User cvetomirconev's Avatar
    Join Date: Apr:2006
    Location: Sevlievo
    Posts: 175
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |