vertc

27-03

Mar 27th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>     // dane https://pastebin.com/Xbm2ctpu
  2. #include <cmath>
  3. #include <cstdlib>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     string alfabet = "ABCEDFGHIJKLMNOPQRSTUVWXYZ";
  10.     int il = alfabet.length(), lol[2999];
  11.     string wyraz, szyfr;
  12.     int dl;
  13.     int klucz = 107%il, i;
  14.     ifstream dane1("dane_6_1.txt");
  15.     ifstream dane2("dane_6_2.txt");
  16.     ofstream wynik1("wynik_6_1.txt");
  17.     ofstream wynik2("wynik_6_2.txt");
  18.     while (!dane1.eof()) {
  19.         dane1>>wyraz;       // ZADANIE 1
  20.         dl = wyraz.length();
  21.         cout<<"Wyraz jawny: "<<wyraz<<endl<<"Wyraz zaszyfrowany: ";
  22.         for(i=0;i<dl;i++) {
  23.             cout<<char(wyraz[i]+klucz);
  24.             wynik1<<char(wyraz[i]+klucz);
  25.         }
  26.         wynik1<<endl;
  27.         cout<<endl<<endl;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment