Advertisement
borisdexter

Main

Jan 25th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. int main(){
  2. cout<<"Testing parameter constructor"<<endl;
  3. Kniga lotr("The lord of the rings", 111222, 1000, 1955, "R.R. Tolkien");
  4. lotr.print();
  5. Kniga hp("Harry Potter", 222333, 1500);
  6. hp.setGodina(1991);
  7. hp.setAvtor("J.K. Rowling");
  8. hp.print();
  9. cout<<"Testing copy constructor"<<endl;
  10. Kniga hp2(hp);
  11. hp2.print();
  12. cout<<"Testing operator="<<endl;
  13. Kniga hp3;
  14. hp3=hp;
  15. cout<<"Testing operator <<"<<endl;
  16. cout<<hp3;
  17. cout<<"Testing operator >>"<<endl;
  18. Kniga got("GoT",333444,1750,1993,"R.R.Martin");
  19. //cin>>got;
  20. cout<<got;
  21. cout<<"Testing operator <"<<endl;
  22. if(hp<got){
  23. cout<<"HP<GOT"<<endl;
  24. }else{
  25. cout<<"HP>GOT"<<endl;
  26. }
  27. cout<<"Testing operator =="<<endl;
  28. if(hp==got){
  29. cout<<"HP==GOT"<<endl;
  30. }else{
  31. cout<<"HP!=GOT"<<endl;
  32. }
  33. cout<<"Testing static"<<endl;
  34. cout<<hp.cenaVoEvra()<<endl;
  35. Kniga::setEvro(61.7);
  36. cout<<hp.cenaVoEvra()<<endl;
  37.  
  38. Biblioteka bm("Brakja Miladinovci", 3);
  39. cout<<"Testirame += operator"<<endl;
  40. try{
  41. bm+=hp;
  42. bm+=got;
  43. bm+=lotr;
  44. bm+=hp;
  45. }catch(SameBookException &objekt){
  46. objekt.print();
  47. }catch(MaxCapacity &objekt){
  48. objekt.print();
  49. }
  50.  
  51. bm.printKnigi();
  52. cout<<"Testirame -= operator"<<endl;
  53. bm-=hp;
  54. bm.printKnigi();
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement