Advertisement
Guest User

Untitled

a guest
May 24th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. void cezar(string a1,int key1,int caseChoose1){
  6. for(int i = 0; i<a1.length() ;i++){
  7. if (caseChoose1 == 1)
  8. a1[i] +=key1;//шифрование
  9. if (caseChoose1 == 2)
  10. a1[i] -=key1;//дешифрование
  11. }
  12. cout << a1 << endl;
  13. }
  14.  
  15. int main (int argc[], char* argv[50])
  16. {
  17. setlocale(LC_ALL, "Russian");
  18. string a;
  19. int key,caseChoose;
  20. key = atoi(argv[1]);
  21. caseChoose = atoi(argv[2]);
  22. a = argv[3];
  23.  
  24. cezar(a,key,caseChoose);
  25.  
  26. system("PAUSE");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement