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::btnSucetClick(TObject *Sender)
- {
- int c,
- s = 0,
- n = StrToInt(InputBox("Zadajte pocet opakovani","Cislo","0"));
- for (int i = 1; i <= n; i++) {
- c = StrToInt(InputBox("Zadajte cislo","Cislo","0"));
- s += c;
- }
- ShowMessage(IntToStr(s));
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::btnMinClick(TObject *Sender)
- {
- int c,
- s = 0,
- min = 9999999999999999,
- n = StrToInt(InputBox("Zadajte pocet opakovani","Cislo","0"));
- for (int i = 1; i <= n; i++) {
- c = StrToInt(InputBox("Zadajte cislo","Cislo","0"));
- if ( c < min ) {
- min = c;
- }
- }
- ShowMessage(IntToStr(min));
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::btnUmocClick(TObject *Sender)
- {
- int x = StrToInt(InputBox("Zadajte cislo, ktore chcete umocnit","Cislo","0")),
- m = StrToInt(InputBox("Zadajte mocnitela","Cislo","0")),
- v = 1;
- for (int i = 1; i <= m; i++) {
- v = v * x;
- }
- ShowMessage(IntToStr(v));
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::btnPrestClick(TObject *Sender)
- {
- int rok = StrToInt(InputBox("Zadajte rok","Rok","2018"));
- if ( rok % 4 == 0) {
- ShowMessage("Rok "+IntToStr(rok)+" je prestupny");
- } else {
- ShowMessage("Rok "+IntToStr(rok)+" nieje prestupny");
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::btnZnamClick(TObject *Sender)
- {
- int z = StrToInt(InputBox("Zadajte znamku","Znamka","1"));
- switch ( z ) {
- case 1 :
- ShowMessage("Velmi vyborne");
- break;
- case 2 :
- ShowMessage("Vyborne");
- break;
- case 3 :
- ShowMessage("Dobre");
- break;
- case 4 :
- ShowMessage("Zle");
- break;
- case 5 :
- ShowMessage("Velmi zle");
- break;
- }
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment