Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- string tekst1,tekst2,tekst3;
- int miejsce,ilosc_znakow;
- namespace operacje
- {
- string polacz(string tekst1,string tekst2)
- {
- return (tekst1+tekst2);
- }
- string usun(string tekst1,int miejsce,int ilosc_znakow)
- {
- return ( tekst1.erase(miejsce,ilosc_znakow));
- }
- bool porownaj(string tekst1,string tekst2)
- {
- if(tekst1==tekst2)
- return 1;
- else return 0;
- }
- }
- using namespace operacje;
- void pobierz()
- {
- cout<<"Podaj dwa ciagi znakow do polaczenia"<<endl;
- cin>>tekst1;
- cin>>tekst2;
- }
- void pobierz1()
- {
- cout<<endl<<"Podaj slowo do usuniecia fragmentu ";
- cin>>tekst3;
- cout<<"Podaj miejsce do wyciecia ";
- cin>>miejsce;
- cout<<"Oraz ilosc znakow ";
- cin>>ilosc_znakow;
- cout<<endl;
- }
- int main()/////////////////////////////////////////////////
- {
- pobierz();
- cout<<endl<<"1) Polaczone ciagi znakow: ";
- cout<<polacz(tekst1,tekst2)<<endl;
- pobierz1();
- cout<<"2) Wyraz po usunieciu: ";
- cout<<usun(tekst3,miejsce,ilosc_znakow)<<endl;
- cout<<"3) Czy wyraz z punktu 1 sa takie same? ";
- cout<<porownaj(tekst1,tekst2)<<endl;
- cout<<"Koniec pracy programu"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement