2

Click here to load reader

contoh script program C++

  • Upload
    iasha

  • View
    3

  • Download
    0

Embed Size (px)

DESCRIPTION

yayayay

Citation preview

Page 1: contoh script program C++

7/21/2019 contoh script program C++

http://slidepdf.com/reader/full/contoh-script-program-c 1/2

//---------------------------------------------------------------------------

#include <vcl.h>#pragma hdrstop

#include "SOAL4_1_1.h"//---------------------------------------------------------------------------#pragma package(smart_init)#pragma resource "*.dfm"TForm1 *Form1;int data[20];//---------------------------------------------------------------------------

 __fastcall TForm1::TForm1(TComponent* Owner)  : TForm(Owner){}//---------------------------------------------------------------------------void __fastcall TForm1::Button1Click(TObject *Sender){if (Trim(StringGrid1->Cells[1][1])=="")ShowMessage("Data Harus Diisi Dulu!,Press OK");else{Label2->Show();StringGrid2->Show();

int j,jd=0,temp;AnsiString b;//simpan data ke variabel memory array!for (j=1;j<=10;j++){b=StringGrid1->Cells[1][j];if(Trim(b)!=""){data[j]=StrToInt(StringGrid1->Cells[1][j]);jd=jd+1;}else data[j]=0;}//Proses Pensortiran metode pemilihanint i,k;

i=1;j=1;for (j=i+1;j<=jd;j++)for (k=i;k<=jd;k++){temp=data[i];if(data[j]<=temp){k=j;temp=data[j];data[k]=data[i];data[i]=temp;}j=j+1;data[k+1]=temp;

}while (i<=jd)data[k+1]=temp;//Proses menampilkan data hasil pensortiranint m;for (m=1;m<=jd;m++)}StringGrid2->Cells[1][m]=IntToStr(data[m]);}}//---------------------------------------------------------------------------void __fastcall TForm1::FormCreate(TObject *Sender)

Page 2: contoh script program C++

7/21/2019 contoh script program C++

http://slidepdf.com/reader/full/contoh-script-program-c 2/2

{StringGrid1->RowCount=11;StringGrid1->ColCount=2;StringGrid1->ColWidths[0]=30;StringGrid1->ColWidths[1]=90;StringGrid1->Cells[0][0]="NO.";StringGrid1->Cells[1][0]="Bilangan";int i;for (i=1;i<=10;i++)StringGrid1->Cells[0][i]=IntToStr(i);

StringGrid2->RowCount=11;StringGrid2->ColCount=2;StringGrid2->ColWidths[0]=30;StringGrid2->ColWidths[1]=90;StringGrid2->Cells[0][0]="NO.";StringGrid2->Cells[1][0]="Bilangan";int j;for (j=1;j<=10;j++)StringGrid2->Cells[0][j]=IntToStr(j);Label1->Hide();StringGrid2->Hide();}//---------------------------------------------------------------------------