Results 1 to 3 of 3

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: May:2019
    Location:
    Posts: 1

    C++

    ! : a b, m . - . !

    , :
    #include <stdio.h>
    #include <stdlib.h>
    struct triagulnik{
    float katetA[20];
    float katetB[20];}

    void main ()
    {
    triagulnik kateti[20];
    int i,m;
    float a,b,S;
    system ("chcp 1251");
    printf (" : "); scanf ("%d", &m);
    for (i=0;i<m;i++)
    {
    printf (" : "); scanf ("%f",&kateti[i].katetA);
    printf (" B: "); scanf ("%f",&kateti[i].katetB);
    }

    for (i=0;i<m;i++)
    {
    S=(a*b/2);
    int maxS=0;
    for (i=0;i<m;i++)
    if (S>maxS) maxS=i+1;
    printf (" - : %d",maxS);
    }
    system ("pause");
    }

    !

  2. #2
    Registered User
    Join Date: Oct:2013
    Location: GB
    Posts: 340
    1. - - - , ?
    2. , - , :
    Code:
    int ____ = 0;
    int ______;
    for (i=0;i<m;i++){
    	S=((kateti[i].katetA*kateti[i].katetB)/2);
    	if(S > ____){
    		______ = i+1;
    		____ = S;
    	}
    }
    printf ("    -  : %d", ______);
    Last edited by gan4o; 11th May 2019 at 21:16.

  3. #3
    Registered User Fluffy_Elke's Avatar
    Join Date: Jul:2006
    Location: around
    Posts: 102
    . , 20 20 .
    2 .
    .

    class Triangle {
    public:
    int sideA;
    int sideB;
    }

    Triangle
    Triangle arr[10];
    10
    10 .
    arr[i].sideA = userInputA;
    arr[i].sideB = userInputB;

    . S = (a * b / 2);
    a b . garbage, undefined value.
    , , 10
    S = ((arr[i].sideA * arr[i].sideB) / 2);
    S >= maxS.
    , .
    C++ C++ , C. .
    Last edited by Fluffy_Elke; 14th May 2019 at 17:20.
    [MSI B450 Tomahawk][AMD Ryzen 3600][2x8GB3200Mhz CorsairVengeance][512GB SSD Samsung EVO 960, 3TB Toshiba HDD 7200, 1TB Hitachi 7200 SATA2 ][Gigabyte RX 5700 XT Gaming OC][Seasonic 600W]

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 |