Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include "kosarica.h"
- int main () {
- Kosarica k1;
- cout << k1 << endl; // prazan string
- (pair<string, int>("sol", 3) | (k1 | pair<string, int>("sol", 5))) | pair<string, int>("papar", 8);
- cout << k1 << endl; // (papar,8)-(sol,3)-(sol,5)
- cout << +k1 << " " << -k1 << endl; // 8 3
- cout << --(k1--) << endl; // (sol,3)-(sol,5)
- cout << --((k1--)--) << endl; // (sol,5)
- k1 = --(--k1);
- cout << (bool)k1 << " " << (double)k1 << endl; // 1 0
- cout << +k1 << " " << -k1 << endl; // 0 0
- cout << (k1 & k1) << endl; // prazan string
- cout << k1 % 's' << endl; // prazan string
- cout << k1 % 8 << endl; // prazan string
- Kosarica k2;
- (pair<string, int>("sol", 3) | (k2 | pair<string, int>("sol", 5))) | pair<string, int>("papar", 8);
- k1 = k2 & k2 & k2;
- cout << (k2 & k2) << endl; // (sol,5)-(sol,3)-(papar,8)-(sol,5)-(sol,3)-(papar,8)
- cout << k1 << endl; // (sol,5)-(sol,3)-(papar,8)-(papar,8)-(sol,3)-(sol,5)-(papar,8)-(sol,3)-(sol,5)
- cout << k2 << endl; // (papar,8)-(sol,3)-(sol,5)
- cout << (bool)k1 << " " << (double)k1 << endl; // 0 48
- cout << (k2 % 's') << endl; // (sol,3)-(sol,5)
- cout << (k1 % 19) << endl; // (sol,3)-(sol,5)-(papar,8)-(sol,3)
- cout << (k1 % 18) << endl; // prazan string
- Kosarica k3 = ((k2 % 's') & (k1 % 19)) & (k1 % 18);
- cout << k3 << endl; // (sol,3)-(sol,5)-(sol,3)-(sol,5)-(papar,8)-(sol,3)
- k3 | pair<string, int>("brasno", 10);
- cout << k3 << endl; // (brasno,10)-(sol,3)-(sol,5)-(sol,3)-(sol,5)-(papar,8)-(sol,3)
- cout << ~(k1 % 18) << " " << ~k3 << endl; // 0 5.28571
- Kosarica k4;
- k4 | pair<string, int>("papuce", 100) | pair<string, int>("tv", 1000);
- cout << (k2 & k4) << endl; // (papuce,100)-(tv,1000)-(sol,5)-(sol,3)-(papar,8)
- Kosarica k5;
- 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);
- cout << (k5 % 7) << endl; // (sol,5)-(sol,1)-(sol,1)
- Kosarica k6;
- for(int i = 0; i < 10000000; i++) {
- k6 | pair<string, int> ("a", 2);
- }
- for(int i = 0; i < 999; i++) {
- k6 | pair<string, int> ("b", 1);
- }
- double start = clock();
- Kosarica k7 = k6 % 999;
- printf("Vrijeme izvrsavanja: %.2lf sec\n",(clock()-start)/CLOCKS_PER_SEC);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement