Results 1 to 16 of 16

Thread: ++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Monkey Business poseydon's Avatar
    Join Date: Mar:2004
    Location: Sofia
    Posts: 1,537

    ++

    , , . 3 if else, .

    if (a>b)
    {
    if (a>c)
    a = A;
    }

    else if (b>a)
    {
    if (b>a)
    b = A;
    }

    else (c>a)
    {
    if (c>b)
    c = A;
    }

    , - . 3 - ...
    Ad astra per aspera - To the stars through difficulties
    Nvidia - The way you are meant to be played!
    Blog - http://poseyd0n.blogspot.com/

  2. #2
    no one ceco_todorov's Avatar
    Join Date: Jul:2006
    Location: Sofia
    Posts: 63
    int max;

    if (a > b)
    {
    ___if (a > c)
    ___{
    ______max = a;
    ___}
    ___else
    ___{
    ______max = c;
    ___}
    }
    else
    {
    ___if (b > c)
    ___{
    ______max = b;
    ___}
    ___else
    ___{
    ______mx = c;
    ___}
    }

    _, -.

  3. #3
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169


    Code:
    int max = a;
    if (b > max) max = b;
    if (c > max) max = c;
    [bg] [/bg]

    update: :

    Code:
    #include <algorithm>
    
    ...
    
    int max = std::max(a, std::max(b, c));
    , !

  4. #4
    Registered User singularity's Avatar
    Join Date: Apr:2003
    Location:
    Posts: 3,382
    Quote Originally Posted by Psho

    Code:
    max=(b>a)?b:((c>a)?c:a);
    ignore list:Java,velio,jaredharet,gochev.george,Nit rogenium
    Quis custodiet ipsos custodes?

  5. #5
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    Quote Originally Posted by singularity

    Code:
    max=(b>a)?b:((c>a)?c:a);


    a=1, b=2, c=3
    , !

  6. #6
    Registered User singularity's Avatar
    Join Date: Apr:2003
    Location:
    Posts: 3,382
    Quote Originally Posted by Pesho

    a=1, b=2, c=3
    , ...
    ++

    Code:
    max=(b>a)?((c>b)?c:b):((c>a)?c:a);
    ignore list:Java,velio,jaredharet,gochev.george,Nit rogenium
    Quis custodiet ipsos custodes?

  7. #7
    XaMaB's Avatar
    Join Date: Nov:2001
    Location:
    Posts: 20,387
    :

    Quote Originally Posted by poseydon
    a = A;
    b = A;
    c = A;

    Quote Originally Posted by poseydon
    ...
    : XaMaB; . 0.42

    In God we Trust (all others must submit a X.509 certificate). , ()

  8. #8
    Defender Kaspirtov's Avatar
    Join Date: Jun:2006
    Location: Sf
    Posts: 7,414
    Quote Originally Posted by XaMaB
    ... ...
    ...
    @poseydon ? max(a,b,c) " ...", , , , .. max(a,b,c) , .

    , - a,b,c max[3], , , index i (i=1,2, 3) max[i] = A;

    .. - <->. , max(a,b,c) , - - a, b c...
    " , , , , ."

  9. #9
    Monkey Business poseydon's Avatar
    Join Date: Mar:2004
    Location: Sofia
    Posts: 1,537
    : , , . - . , ... - , , , .


    :

    6, .

    , , - . :

    #include <iostream>
    #include <cmath>

    using namespace std;

    int main()
    {
    double a,b,c; /*Trite strani na triugulnika*/
    double S; /*Liceto na triugulnika*/
    double K; /*Koeficient K*/
    double sin; /*Sinus promenliva*/

    cout << "Enter a side of the triangle\n";
    cin >> a;

    cout << "Enter b side of the triangle\n";
    cin >> b;

    cout << "Enter c side of the triangle\n";
    cin >> c;


    double max = a; /*Promenliva za nai-golemia ugul*/
    if (b > max) max = b;
    if (c > max) max = c;
    cout << max;


    S = (a + b + c) / 2;
    K = sqrt(S* (S-a) * (S-b) * (S-c));

    if (max = a) sin = 2*K / (b*c);
    if (max = b) sin = 2*K / (a*c);
    if (max = c) sin = 2*K / (a*b);

    cout << "Sine from the biggest angle is" << sin << "\n";

    system("Pause");
    return 0;
    }
    Last edited by poseydon; 10th November 2006 at 13:36.
    Ad astra per aspera - To the stars through difficulties
    Nvidia - The way you are meant to be played!
    Blog - http://poseyd0n.blogspot.com/

  10. #10
    Registered User singularity's Avatar
    Join Date: Apr:2003
    Location:
    Posts: 3,382
    , - Pesho, . max .
    . 6 ?
    ignore list:Java,velio,jaredharet,gochev.george,Nit rogenium
    Quis custodiet ipsos custodes?

  11. #11
    no one ceco_todorov's Avatar
    Join Date: Jul:2006
    Location: Sofia
    Posts: 63
    5 10 . .

    3 , . 1 1 - 5 ... 2 + ...

    2 + 3 .

  12. #12
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    . ! S , , " ". , .
    Code:
    if (max = a) sin = 2*K / (b*c);
    if (max = b) sin = 2*K / (a*c);
    if (max = c) sin = 2*K / (a*b);
    "=" , . sin(<ACB). 3,4,5 , 5,3,4 . , :
    Code:
    if (max == a) sin = 2*K / (b*c);
    if (max == b) sin = 2*K / (a*c);
    if (max == c) sin = 2*K / (a*b);
    else...
    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

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 |