Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<cstdlib>
- #include<cmath>
- #include<ctime>
- #include<string>
- using namespace std;
- /*-------------------------------ZAD1
- string usunto(string a,string b)
- {
- string c;
- c=a+b;
- return c;
- }
- int main()
- {
- string a,b,c;
- getline(cin,a);
- getline(cin,b);
- c=usunto(a,b);
- cout<<endl<<c<<endl;
- system("pause");
- }
- -------------------------------ZAD1*/
- /*-------------------------------ZAD2
- string usunto(string a,char b)
- {
- for(int i=0;i<a.length();i++)
- {
- if(a.at(i)==b)
- {
- a.erase(i,1);
- i--;
- }
- }
- return a;
- }
- int main()
- {
- string a,b;
- char c;
- getline(cin,a);
- cin>>c;
- b=usunto(a,c);
- cout<<endl<<b<<endl;
- system("pause");
- }
- -------------------------------ZAD2*/
- /*-------------------------------ZAD3
- string dodaj(string a)
- {
- for(int i=0;i<a.length();i++)
- {
- if(a.at(i)=='a')
- {
- a.insert(i,1,',');
- i++;
- }
- }
- return a;
- }
- int main()
- {
- string a,b;
- getline(cin,a);
- b=dodaj(a);
- cout<<endl<<b<<endl;
- system("pause");
- }
- -------------------------------ZAD3*/
- /*
- void sort(string *a[],int b)
- {
- for (int l=1;l>0;)
- {
- l=0;
- for(int i=0;i<b;i++)
- {
- for(int j=0;j<a[i].length();j++)
- if(a[i].at(j)>a[i].at(j+1))
- {
- swap(a[i],a[i+1])
- l++;
- }
- }
- }
- }
- int main()
- {
- int a;
- cout<<"Wprowadz ilosc imion: ";
- cin>>a;
- cout<<endl;
- string *tab= new string[a];
- cout<<"Wprowadz imiona: "<<endl;
- for(int i=0;i<a;i++)
- {
- getline(cin,tab[i]);
- }
- string *tab2= new string[a];
- tab2=sort(tab[],a);
- for(int i=0;i<a;i++)
- {
- cout<<tab2[i]<<endl;
- }
- system("pause");
- delete [] tab;
- delete [] tab2;
- }
- */
- /*-------------------------------ZAD5
- void palin(string a)
- {
- int d=a.length()-1;
- for(int i=0;i!=d;i++,d--)
- {
- if(a[i]!=a[d])
- {
- cout<<"Ten wyraz nie jest palindromem"<<endl;
- system("pause");
- exit(0);
- }
- }
- cout<<"Ten wyraz jest palindromem"<<endl;
- system("pause");
- }
- int main()
- {
- string a;
- getline(cin,a);
- palin(a);
- }
- -------------------------------ZAD5*/
Advertisement
Add Comment
Please, Sign In to add comment