C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| #include <vcl.h>
#pragma hdrstop
#include "math.h" //!!!!!!!!!!!!!!!!!!!!! не забудь иначе модуль не заработает
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int l=Memo1->Lines->Count, count, max; max=0;count=0;
float arr[100], mul; mul=1;
for (int i=0;i<l;i++)
{arr[i]=StrToFloat(Memo1->Lines->Strings[i]);}
for (int i=0;i<l;i++)
{if (arr[i]>StrToFloat(Edit1->Text)) count++;
if (abs(arr[i])>abs(arr[max])) max=i; }
for (int i=max+1; i<l; i++)
{mul*=arr[i];}
Memo1->Lines->Add("÷èñëî ýëåìåГ*òîâ = "+IntToStr(count));
Memo1->Lines->Add("ïðîèçâåäåГ*ГЁГҐ = "+FloatToStr(mul));
} |
|
в мемо в столбик введены числа, в edit1 число с.