c++ builderでのgui program sample1
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.
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#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;
|
|
|
|
long long sum=0;
|
|
|
|
|
|
|
|
upper = StrToInt(Edit1->Text);
|
|
|
|
|
|
|
|
for( i= 1 ; i <= upper ; i++ )
|
|
|
|
sum += i;
|
|
|
|
Label3->Caption = IntToStr(sum);
|
|
|
|
|
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|