1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include<iostream>
#include<string>
using std::cout;
using std::endl;
using std::cin;
using std::string;
void main(){
string proto = "Nothing";
char key[27] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
cout << "Word:";
cin >> proto;
int len = proto.length();
int keylen = sizeof key;
cout << endl;
cout <<"- - - - - - - - - - - - - - - -" << endl;
for(int x = 0; x < len; x++){
for(int y = 0; y < keylen; y++){
if(proto[x] == key[y]){ proto[x] = key[y + 1];}
else if(proto[x] != key[y]){;}
}
cout << proto[x];
}
}
|