Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #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::FormCreate(TObject *Sender)
- {
- StringGrid1->Cells[0][0]="Cisla";
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- for (int i = 1; i < StringGrid1->RowCount; i++) {
- StringGrid1->Cells[0][i] = "";
- StringGrid1->Cells[1][i] = "";
- StringGrid1->Cells[2][i] = "";
- }
- StringGrid1->RowCount=2;
- for (int i = 1; i <= 10; i++) {
- int n = random(1000);
- StringGrid1->RowCount++;
- StringGrid1->Cells[0][i] = IntToStr(n);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- int l = StrToInt(InputBox("Pocet opakovani","Zadajte cislo","0"));
- for (int i = 1; i < StringGrid1->RowCount; i++) {
- StringGrid1->Cells[0][i] = "";
- StringGrid1->Cells[1][i] = "";
- StringGrid1->Cells[2][i] = "";
- }
- StringGrid1->RowCount=2;
- for (int i = 1; i <= l; i++) {
- StringGrid1->RowCount++;
- int n = random(1000);
- StringGrid1->Cells[0][i] = IntToStr(n);
- n = random(1000);
- StringGrid1->Cells[1][i] = IntToStr(n);
- n = random(1000);
- StringGrid1->Cells[2][i] = IntToStr(n);
- }
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment