Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- string szyfruj(string napis)
- {
- int dl = napis.size();
- string w = "";
- int pietra = 5;
- int co_ile = pietra*2-2;
- int ile = 6;
- int ile1 = 2;
- for(int i=0;i<pietra-1;i++)
- {
- int x=0;
- if(i==0 || i==pietra-1)
- {
- for(int j=i;j<dl;j+=co_ile)
- {
- w+=napis.at(j);
- }
- }else{
- for(int j=i;j<dl;j+=0)
- {
- if(j<napis.size())
- {
- w+=napis.at(j);
- }
- cout<<j;
- if(x+i%2)j+=ile;
- else j+=ile1;
- x++;
- }
- ile1+=2;
- ile-=2;
- }
- }
- return w;
- }
- string litery(string napis, string napis2)
- {
- string wspolne = "";
- for(int i=0;i<napis.size();i++)
- {
- for(int j=0;j<napis2.size();j++)
- {
- if(napis.at(i)==napis2.at(j))wspolne+=napis.at(i);
- }
- }
- return wspolne;
- }
- bool szukaj(string napis)
- {
- string samoT = "aeiouy";
- string spolT = "bcdfghjklmnpqrstvwxz";
- int samo = 0;
- int spol = 0;
- for(int i=0;i<napis.size();i++)
- {
- for(int j=0;j<samoT.size();j++)
- {
- if(napis.at(i)==samoT.at(j))samo++;
- }
- for(int j=0;j<spolT.size();j++)
- {
- if(napis.at(i)==spolT.at(j))spol++;
- }
- }
- cout<<samo<<" , "<<spol;
- }
- int main()
- {
- string napis = "ABCDEFGHIJKLMNO";
- string napis2 = "ACBC";
- cout<<szyfruj(napis);
- //cout<<litery(napis,napis2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement