SHARE
TWEET

Untitled

a guest May 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sstream>
  2. #include <iostream>
  3. #include <string.h>
  4. #include <ios>
  5.  
  6. using namespace std;
  7.  
  8.  int main(int argc, char* argv[])
  9. {
  10.  if (argc<2)
  11.  {
  12.  cout<<"Usage word1 or word1 word2"<<endl;
  13.  return(-1);
  14.  }
  15.  
  16.  string c;
  17.  if (argc==2)
  18.      c="\0";
  19.  else {
  20.      c=argv[2];
  21.      c.append(" ");
  22.  }
  23.  string s, str;
  24.  
  25.  cout<<"Input text:\n";
  26.  
  27.  
  28.  
  29.  while (cin)
  30.  {
  31.      
  32.      cin>>s;
  33.  if (s == argv[1]) {
  34.     s=c;
  35.     str.append(s);
  36.  }
  37.  else {
  38.     str.append(s);
  39.     str.append(" ");
  40.  }
  41.  
  42.  }
  43.  
  44.  cout<<"\nYour edited text:\n"<<str<<" "<<endl;
  45.  
  46.  return(0);
  47.  
  48. }
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