Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- string wyraz;
- int corobic;
- int main()
- {
- cout << "Podaj teskst do zamiany" << endl;
- getline(cin, wyraz);
- cout<<"Zakodowac(1) czy odkodowac(2)?"<<endl;
- cin>>corobic;
- int dl= wyraz.size();
- for(int i=0; i<dl-1;)
- {
- char pom;
- if(wyraz[i+1]==32)
- {
- i+=2;
- }else if(wyraz[i]==32)
- {
- i+=1;
- }else
- {
- pom = wyraz[i];
- wyraz[i] = wyraz[i+1];
- wyraz[i+1] = pom;
- i+=2;
- }
- }
- if(corobic == 1)
- {
- cout<<"Tekst zaszyforwany: "<<wyraz;
- }else if(corobic==2)
- {
- cout<<"Tekst odszyfrowany: "<<wyraz;
- }else
- {
- cout<<"Nie podales poprawnej liczby ;( ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement