You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
784 B
32 lines
784 B
10 months ago
|
//---------------------------------------------------------------------------
|
||
|
|
||
|
#include <vcl.h>
|
||
|
#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)
|
||
|
{
|
||
|
int upper;
|
||
|
int i;
|
||
|
int sum=0;
|
||
|
|
||
|
upper = StrToInt(Edit1->Text);
|
||
|
|
||
|
for( i= 1 ; i <= upper ; i++ )
|
||
|
sum += i;
|
||
|
Label3->Caption = IntToStr(sum);
|
||
|
|
||
|
}
|
||
|
//---------------------------------------------------------------------------
|
||
|
|