SHARE
TWEET

Untitled

a guest Dec 8th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char s[251], init[251]="", c1, c2;
  9.     cin>>c1;
  10.     cin>>c2;
  11.     cin.get(s, 250);
  12.     strcpy(s, init);
  13.     for(int i=0; i<strlen(s)-1; i++)
  14.         if(s[i]==c1)
  15.             s[i]==c2;
  16.         else if(s[i]==c2)
  17.             s[i]==c1;
  18.     cout<<init<<endl;
  19.     cout<<s;
  20.  
  21.  
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top