Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int c,d;
- void vignere(string a, string b){
- c = a.length();
- d = b.length();
- for (int i = 0; i < c; ++i){
- int e = a[i] - 64, f = b[i%d] - 64;;
- if(a[i] == ' ')e=0;
- if(b[i] == ' ')f=0;
- int x = (e+f)%27;
- char t = x + '@';
- if(x==0){cout << ' ';continue;}
- cout << t;
- }
- }
- int main(){
- string a,b;
- cout << "Enter Message to encrypt: ";
- getline(cin,a);
- cout << "Enter keyword: ";
- getline(cin,b);
- vignere(a,b);
- }
Add Comment
Please, Sign In to add comment