Results 1 to 3 of 3
Thread: C++
Hybrid View
-
11th May 2019 20:10 #1Registered 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");
}
!
-
11th May 2019 21:07 #2Registered 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.
-
14th May 2019 17:18 #3
. , 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]




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