Advertisement
Guest User

Untitled

a guest
Feb 1st, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <cstdlib>
  5. #include <time.h>
  6. #include <cstring>
  7. using namespace std;
  8.  
  9. int i;
  10. char x;
  11. string a="abcdefghijklmnoprstuwqxvyz_1234567890";
  12. string b="09876543214mnbvcxzlkjhgfdsapoiuytrewq";
  13. string c;
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19.     while(true)
  20.     {
  21.  
  22.     cout<<"Wpisz x jesli chcesz zamienc znaki lub downolny znak by odwrucic! "<<endl;
  23.     cin>>x;
  24.  
  25.  
  26.     system( "cls" );
  27.     cout<<"Podaj wyraz w ktorym chcesz zamienic znaki: "<<endl;
  28.     cin>>c;
  29.     if(c=="koniec") //warunek
  30.     {
  31.         exit(0);
  32.     }
  33.  
  34.     if(x=='x')
  35.     {
  36.  
  37.         int n=c.length();
  38.  
  39.  
  40.  
  41.         for(i=0; i<n; i++)
  42.         {
  43.             int h=b.find(c[i]);
  44.             cout<<a[h];
  45.         }
  46.         cout<<endl;
  47.     }
  48.  
  49.     else
  50.     {
  51.  
  52.  
  53.         int l=c.length();
  54.  
  55.  
  56.  
  57.         for(i=0; i<l; i++)
  58.         {
  59.             int h=a.find(c[i]);
  60.             cout<<b[h];
  61.  
  62.         }
  63.         cout<<endl;
  64.     }
  65.  
  66.     system("pause");
  67.     system( "cls" );
  68.     }
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement