Advertisement
TheMagnusRex

12_2

Feb 12th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string fi,fo,w1,w2,w3;
  10.     cout<<"raspolozhenie fayla vvoda:";
  11.     cin>>fi;
  12.     cout<<endl;
  13.     cout<<"raspolozhenie fayla vyvoda:";
  14.     cin>>fo;
  15.     cout<<endl;
  16.     cout<<"zamenit' slovo:";
  17.     cin>>w1;
  18.     cout<<endl<<"na:";
  19.     cin>>w2;
  20.     ifstream inp;
  21.     ofstream outp;
  22.     inp.open(fi);
  23.     outp.open(fo);
  24.     while(inp>>w3){
  25.         if(w3==w1){
  26.             outp<<w2<<" ";
  27.         }
  28.         else{
  29.             outp<<w3<<" ";
  30.         }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement