Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- void encrypt( std::string &iostr,int key){
- key %= 26;
- int ch;
- for(auto &it:iostr){
- ch = tolower(it) + key;
- if( ch > 'z' )
- ch -= 26;
- it = ch;}}
- int main(){
- std::string source = "zebra";
- int key = 15;
- std::cout << source << std::endl;
- encrypt( source , key );
- std::cout << source << std::endl;
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement