Guest User

Untitled

a guest
Feb 23rd, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdlib>
  4. #include <string>
  5. #include <fstream>
  6. using namespace std;
  7.  
  8. int main()
  9.  
  10. {
  11. string wyraz, czlon2,czlon1;
  12. cout<<"podaj wyraz zakonczony @"<<endl;
  13. cin>> wyraz;
  14. cout<<"podaj dwa czlony do zastapienia xxxx yyyyy .... zzzzz tttttt (x->y, z->t)"<<endl;
  15. cin>>czlon1;
  16. cout<<endl<<"drugi czlon"<<endl;
  17. cin>>czlon2;
  18.  
  19. int dlug = wyraz.length();
  20. int dlug1 = czlon1.length();
  21. int dlug2 = czlon2.length();
  22.  
  23. size_t pozycja1 = czlon1.find(" ");
  24. string nowy1 = czlon1.substr(0,pozycja1); //wyjmujemy pierwszy wyraz z czlonu1 by znalezc go w wyrazie
  25. size_t pozycja11 = wyraz.find(nowy1); //znajdujemy wyraz do zamienienia w glownym
  26. wyraz.replace(pozycja11,???,nowy1);
  27.  
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment