Advertisement
patryk178

Untitled

Oct 29th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. string szyfruj(string napis)
  6. {
  7. int dl = napis.size();
  8. string w = "";
  9. int pietra = 5;
  10. int co_ile = pietra*2-2;
  11. int ile = 6;
  12. int ile1 = 2;
  13.  
  14. for(int i=0;i<pietra-1;i++)
  15. {
  16. int x=0;
  17. if(i==0 || i==pietra-1)
  18. {
  19. for(int j=i;j<dl;j+=co_ile)
  20. {
  21. w+=napis.at(j);
  22.  
  23. }
  24. }else{
  25. for(int j=i;j<dl;j+=0)
  26. {
  27. if(j<napis.size())
  28. {
  29. w+=napis.at(j);
  30. }
  31.  
  32. cout<<j;
  33.  
  34. if(x+i%2)j+=ile;
  35. else j+=ile1;
  36. x++;
  37. }
  38. ile1+=2;
  39. ile-=2;
  40. }
  41.  
  42.  
  43.  
  44.  
  45. }
  46. return w;
  47. }
  48.  
  49. string litery(string napis, string napis2)
  50. {
  51. string wspolne = "";
  52. for(int i=0;i<napis.size();i++)
  53. {
  54. for(int j=0;j<napis2.size();j++)
  55. {
  56. if(napis.at(i)==napis2.at(j))wspolne+=napis.at(i);
  57. }
  58. }
  59.  
  60. return wspolne;
  61. }
  62.  
  63. bool szukaj(string napis)
  64. {
  65. string samoT = "aeiouy";
  66. string spolT = "bcdfghjklmnpqrstvwxz";
  67. int samo = 0;
  68. int spol = 0;
  69. for(int i=0;i<napis.size();i++)
  70. {
  71. for(int j=0;j<samoT.size();j++)
  72. {
  73. if(napis.at(i)==samoT.at(j))samo++;
  74.  
  75.  
  76. }
  77.  
  78. for(int j=0;j<spolT.size();j++)
  79. {
  80. if(napis.at(i)==spolT.at(j))spol++;
  81.  
  82.  
  83. }
  84. }
  85. cout<<samo<<" , "<<spol;
  86. }
  87.  
  88. int main()
  89. {
  90. string napis = "ABCDEFGHIJKLMNO";
  91. string napis2 = "ACBC";
  92. cout<<szyfruj(napis);
  93. //cout<<litery(napis,napis2);
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement