GamerSK

Untitled

Jan 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5.  
  6. #include "Unit1.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma resource "*.dfm"
  10. TForm1 *Form1;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm1::FormCreate(TObject *Sender)
  18. {
  19.     StringGrid1->Cells[0][0]="Cisla";
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::Button1Click(TObject *Sender)
  23. {
  24.     for (int i = 1; i < StringGrid1->RowCount; i++) {
  25.         StringGrid1->Cells[0][i] = "";
  26.         StringGrid1->Cells[1][i] = "";
  27.         StringGrid1->Cells[2][i] = "";
  28.     }
  29.     StringGrid1->RowCount=2;
  30.     for (int i = 1; i <= 10; i++) {
  31.         int n = random(1000);
  32.         StringGrid1->RowCount++;
  33.         StringGrid1->Cells[0][i] = IntToStr(n);
  34.     }
  35. }
  36. //---------------------------------------------------------------------------
  37. void __fastcall TForm1::Button2Click(TObject *Sender)
  38. {
  39.     int l = StrToInt(InputBox("Pocet opakovani","Zadajte cislo","0"));
  40.     for (int i = 1; i < StringGrid1->RowCount; i++) {
  41.         StringGrid1->Cells[0][i] = "";
  42.         StringGrid1->Cells[1][i] = "";
  43.         StringGrid1->Cells[2][i] = "";
  44.     }
  45.     StringGrid1->RowCount=2;
  46.     for (int i = 1; i <= l; i++) {
  47.         StringGrid1->RowCount++;
  48.         int n = random(1000);
  49.         StringGrid1->Cells[0][i] = IntToStr(n);
  50.         n = random(1000);
  51.         StringGrid1->Cells[1][i] = IntToStr(n);
  52.         n = random(1000);
  53.         StringGrid1->Cells[2][i] = IntToStr(n);
  54.     }
  55. }
  56. //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment