#include
#pragma hdrstop
#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)
{ s=0;
for (i=1; i<=50; i++) s=s+1/I;
label1.Caption->FloatToStr(s);
}
//--------------------------------------------------------------
void __fastcall Tform1::Button2Click(Tobject *Sender)
{ i:=1; s:=0;
while (i<=50)
{ s=s+1/I;
i=i+1 }
label2.Caption->FloatToStr(s);
}
//---------------------------------------------------------------------
void __fastcall Tform1::Button3Click(Tobject *Sender)
{ i:=1; s:=0;
Do S=s+1/I;
i=i+1
While i<=50;
label3.Caption->FloatToStr(s);
}
//-----------------------------------------------------------------
Dastur bajarilganda takrorlanish operatorlarini bittasi tanlanadi va natijada Label
komponentalriga mos ravishda Sning qiymati chiqariladi:
20-rasm.
Do'stlaringiz bilan baham: |