GamerSK

sifrovanie

Feb 11th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. //Uloha: Napiste program, ktorĂ˝ nacita zo suboru udaje tak, ze ordinalne hodnoty znakov budu posunute o pet do prava.
  2. void __fastcall TForm1::Button12Click(TObject *Sender)
  3. {
  4.     ifstream f;
  5.     char c;
  6.     f.open("sifra.txt");
  7.     if (f.fail()) {
  8.         ShowMessage("Chyba pri otvarani");
  9.     } else {
  10.         Label2->Caption = "";
  11.         c = f.get() + 5;
  12.         while ( f.good() ) {
  13.             Label2->Caption=Label2->Caption + c;
  14.             c = f.get() + 5;
  15.         }
  16.     }
  17.     f.close();
  18.     ofstream l;
  19.     l.open("sifra-nova.txt");
  20.     AnsiString str = Label2->Caption;
  21.     if (l.fail()) {
  22.         ShowMessage("Chyba pri otvarani");
  23.     } else {
  24.         for (int i = 1; i <= str.Length(); i++) {
  25.             l.put(str[i]);
  26.         }
  27.     }
  28.     l.close();
  29. }
  30. //---------------------------------------------------------------------------
  31.  
  32. void __fastcall TForm1::Button13Click(TObject *Sender)
  33. {
  34.     ifstream f;
  35.     char c;
  36.     f.open("sifra-nova.txt");
  37.     if (f.fail()) {
  38.         ShowMessage("Chyba pri otvarani");
  39.     } else {
  40.         Label3->Caption = "";
  41.         c = f.get() - 5;
  42.         while ( f.good() ) {
  43.             Label3->Caption=Label3->Caption + c;
  44.             c = f.get() - 5;
  45.         }
  46.     }
  47.     f.close();
  48. }
  49. //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment