Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //START Sifrovanie
- AnsiString kluc = InputBox("Zadajte váš klúč","klúč","");
- if ( kluc == "" ) {
- ShowMessage("Musite zadať kluc!!!!!!!!!");
- } else {
- AnsiString str = InputBox("Zadajte text, ktorý chcete zasifrovat","text","");
- AnsiChar c;
- int i = 1;
- int j = 1;
- if ( str == "" ) {
- ShowMessage("Musite zadať text!!!!!!!!!");
- } else {
- ofstream f;
- f.open("sifra-kluc.txt");
- while ( i <= str.Length() ) {
- if ( kluc.Length() == i ) {
- j = 1;
- }
- c = str[i]+kluc[j];
- f.put(c);
- Label4->Caption=Label4->Caption + c;
- i++;
- j++;
- }
- f.close();
- }
- //END Sifrovanie
- //START Získanie šifry
- ifstream g;
- g.open("sifra-kluc.txt");
- AnsiString sifra;
- if ( g.good() ) {
- g.get(c);
- while ( g.good() ) {
- sifra += c;
- g.get(c);
- }
- }
- g.close();
- //END Získanie šifry
- //START Desifrovanie
- ofstream l;
- l.open("desifra-kluc.txt");
- i = 1;
- j = 1;
- while ( i <= sifra.Length() ) {
- if ( kluc.Length() == i ) {
- j = 1;
- }
- c = sifra[i]-kluc[j];
- l.put(c);
- Label5->Caption=Label5->Caption + c;
- i++;
- j++;
- }
- l.close();
- }
- //END Desifrovanie
Advertisement
Add Comment
Please, Sign In to add comment