Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sstream>
- #include <iostream>
- #include <string.h>
- #include <ios>
- using namespace std;
- int main(int argc, char* argv[])
- {
- if (argc<2)
- {
- cout<<"Usage word1 or word1 word2"<<endl;
- return(-1);
- }
- string c;
- if (argc==2)
- c="\0";
- else {
- c=argv[2];
- c.append(" ");
- }
- string s, str;
- cout<<"Input text:\n";
- while (cin)
- {
- cin>>s;
- if (s == argv[1]) {
- s=c;
- str.append(s);
- }
- else {
- str.append(s);
- str.append(" ");
- }
- }
- cout<<"\nYour edited text:\n"<<str<<" "<<endl;
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement