Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdlib>
- #include <string>
- #include <fstream>
- using namespace std;
- int main()
- {
- string wyraz, czlon2,czlon1;
- cout<<"podaj wyraz zakonczony @"<<endl;
- cin>> wyraz;
- cout<<"podaj dwa czlony do zastapienia xxxx yyyyy .... zzzzz tttttt (x->y, z->t)"<<endl;
- cin>>czlon1;
- cout<<endl<<"drugi czlon"<<endl;
- cin>>czlon2;
- int dlug = wyraz.length();
- int dlug1 = czlon1.length();
- int dlug2 = czlon2.length();
- size_t pozycja1 = czlon1.find(" ");
- string nowy1 = czlon1.substr(0,pozycja1); //wyjmujemy pierwszy wyraz z czlonu1 by znalezc go w wyrazie
- size_t pozycja11 = wyraz.find(nowy1); //znajdujemy wyraz do zamienienia w glownym
- wyraz.replace(pozycja11,???,nowy1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment