Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.36 KB | None | 0 0
  1. #include <cstdio>
  2. #include "kosarica.h"
  3.  
  4. int main () {
  5.     Kosarica k1;
  6.     cout << k1 << endl; // prazan string
  7.     (pair<string, int>("sol", 3) | (k1 | pair<string, int>("sol", 5))) | pair<string, int>("papar", 8);
  8.     cout << k1 << endl; // (papar,8)-(sol,3)-(sol,5)
  9.     cout << +k1 << " " << -k1 << endl; // 8 3
  10.     cout << --(k1--) << endl; // (sol,3)-(sol,5)
  11.     cout << --((k1--)--) << endl; // (sol,5)
  12.     k1 = --(--k1);
  13.     cout << (bool)k1 << " " << (double)k1 << endl; // 1 0
  14.     cout << +k1 << " " << -k1 << endl; // 0 0
  15.     cout << (k1 & k1) << endl; // prazan string
  16.     cout << k1 % 's' << endl; // prazan string
  17.     cout << k1 % 8 << endl; // prazan string
  18.  
  19.     Kosarica k2;
  20.     (pair<string, int>("sol", 3) | (k2 | pair<string, int>("sol", 5))) | pair<string, int>("papar", 8);
  21.     k1 = k2 & k2 & k2;
  22.     cout << (k2 & k2) << endl; // (sol,5)-(sol,3)-(papar,8)-(sol,5)-(sol,3)-(papar,8)
  23.     cout << k1 << endl; // (sol,5)-(sol,3)-(papar,8)-(papar,8)-(sol,3)-(sol,5)-(papar,8)-(sol,3)-(sol,5)
  24.     cout << k2 << endl; // (papar,8)-(sol,3)-(sol,5)
  25.     cout << (bool)k1 << " " << (double)k1 << endl; // 0 48
  26.  
  27.     cout << (k2 % 's') << endl; // (sol,3)-(sol,5)
  28.     cout << (k1 % 19) << endl; // (sol,3)-(sol,5)-(papar,8)-(sol,3)
  29.     cout << (k1 % 18) << endl; // prazan string
  30.     Kosarica k3 = ((k2 % 's') & (k1 % 19)) & (k1 % 18);
  31.     cout << k3 << endl; // (sol,3)-(sol,5)-(sol,3)-(sol,5)-(papar,8)-(sol,3)
  32.     k3 | pair<string, int>("brasno", 10);
  33.     cout << k3 << endl; // (brasno,10)-(sol,3)-(sol,5)-(sol,3)-(sol,5)-(papar,8)-(sol,3)
  34.     cout << ~(k1 % 18) << " " << ~k3 << endl; // 0 5.28571
  35.  
  36.     Kosarica k4;
  37.     k4 | pair<string, int>("papuce", 100) | pair<string, int>("tv", 1000);
  38.     cout << (k2 & k4) << endl; // (papuce,100)-(tv,1000)-(sol,5)-(sol,3)-(papar,8)
  39.  
  40.     Kosarica k5;
  41.     k5 | pair<string, int>("sol", 1) | pair<string, int>("sol", 1) | pair<string, int>("sol", 1) | pair<string, int>("sol", 5) | pair<string, int>("sol", 1);
  42.     cout << (k5 % 7) << endl; // (sol,5)-(sol,1)-(sol,1)
  43.  
  44.     Kosarica k6;
  45.     for(int i = 0; i < 10000000; i++) {
  46.         k6 | pair<string, int> ("a", 2);
  47.     }
  48.     for(int i = 0; i < 999; i++) {
  49.         k6 | pair<string, int> ("b", 1);
  50.     }
  51.     double start = clock();
  52.     Kosarica k7 = k6 % 999;
  53.     printf("Vrijeme izvrsavanja: %.2lf sec\n",(clock()-start)/CLOCKS_PER_SEC);
  54.  
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement