Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <fstream.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- AnsiChar c;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender) //Sifra
- {
- Label1->Caption = "";
- ofstream f; //Zapis
- f.open("sifra.txt");
- ifstream g; //Vypis
- g.open("desifra.txt");
- int i = 1;
- if ( g.good() ) {
- c = g.get() + i*i;
- while ( g.good() ) {
- f.put(c);
- Label1->Caption = Label1->Caption + c;
- i++;
- c = g.get() + i*i;
- }
- }
- f.close();
- g.close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender) // Desifra
- {
- Label2->Caption = "";
- ifstream f; //Vypis
- f.open("sifra.txt");
- ofstream g; //Zapis
- g.open("desifra.txt");
- int i = 1;
- if ( f.good() ) {
- c = f.get() - i*i;
- while ( f.good() ) {
- g.put(c);
- Label2->Caption = Label2->Caption + c;
- i++;
- c = f.get() - i*i;
- }
- }
- f.close();
- g.close();
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment