Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main () {
- string alfj = "abcedfgihjklmnopqrstuvwxyz";
- int dla = alfj.size();
- string tekst;
- string alfz[dla];
- for(int i=1;i<dla;i++) {
- if (alfj[i] < 120) {
- alfz[i] = alfj[i-1]+3;
- }
- else {
- alfz[i] = alfj[i-1]+3-25;
- }
- }
- cout<<"Zaszyfrowany alfabet: ";
- for (int i=0;i<dla;i++) {
- cout<<alfz[i];
- }
- cout<<endl<<"Wprowdz tekst do zaszyfrowania: ";
- cin>>tekst;
- int dl = tekst.size();
- string szyfr[dl];
- for (int i=0;i<dl;i++) {
- for (int j=0;j<dla;j++) {
- if(tekst[i] == alfj[j]) {
- szyfr[i] = alfz[j];
- }
- }
- }
- cout<<endl<<"Zaszyfrowany tekst to: ";
- for (int i=0;i<dl;i++) {
- cout<<szyfr[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement