Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. enum Tip{LINUX,UNIX,WINDOWS};
  7.  
  8. class OperativenSisten{
  9. private:
  10. char *ime[];
  11. float version;
  12. Tip t;
  13. float GB;
  14. public:
  15. OperativenSistem(){}//DEFAULT CONSTRUCTOR
  16. OperativenSistem(const char *ime,const float version=0.0,Tip t=(Tip) 0,const float GB=0.0){//CONSTRUCTOR SO ARGUMENTI
  17. this->ime=new char[strlen(ime)+1];
  18. strcpy(this->ime,ime);
  19. this->version=version;
  20. Tip t=t;
  21. this->GB=GB;
  22. }
  23. OperativenSistem(const OperativenSistem& os){
  24. this->ime=new char[strlen(os.ime]+1];
  25. strcpy(this->ime,os.ime);
  26. this->version=os.version;
  27. Tip t=os.t;
  28. this->GB=os.GB;
  29. }
  30. OperativenSistem &operator=(const OperativenSistem &os){
  31. if(this!=&os){
  32. delete [] ime;
  33. this->ime=new char[strlen(os.ime)+1];
  34. strcpy(this->ime,os.ime);
  35. this->version=os.version;
  36. Tip t=os.t;
  37. this->GB=os.GB;
  38.  
  39. }
  40. return *this;
  41. }
  42. ~OperativenSistem(){
  43. delete [] ime;
  44. }
  45. void pecati(){
  46. //Ime: Ubuntu Verzija: 16.04 Tip: 1 Golemina:1.25GB
  47. cout<<"Ime: "<<ime<<"Verzija: "<<version<<"Tip: "<<t<<"Golemina: "<<GB<<"GB"<<endl;
  48.  
  49. }
  50. bool ednakviSe(const OperativenSistem &os){
  51. if(strcmp(this->ime,os.ime==0) && this->version==os.version && this->t==os.t && this->GB==GB){
  52. return true;
  53. }
  54. else
  55. return false;
  56. }
  57. int sporediVerzija(const OperativenSistem &os){
  58. if(this->version==os.version)
  59. return 0;
  60. else if(this->version>os.version){
  61. return -1;
  62. else
  63. return 1;
  64. }
  65. }
  66. bool istaFamilija(const OperativenSistem &sporedba){
  67. if(strcmp(this->ime,os.ime==0) && this->t==t;){
  68. return true;
  69. else
  70. return false;
  71. }
  72. }
  73. };
  74. class Repozitorium{
  75. private:
  76. char ime[20];
  77. OperativenSistem *sistemi;
  78. int brojOS;
  79. public:
  80. Reporzitorium(){}//DEFAULT CONSTRUCTOR
  81. Reporzitorium(const char *ime,OperativenSistem *sistemi,int brojOS){//CONSTRUCTOR SO ARGUMENTI
  82. strcpy(this->ime,ime);
  83. this->brojOS=brojOS;
  84. this->sistemi= new OperativenSistem[brojOS];
  85. for(int i=0;i<brojOS;++i){
  86. this->sistemi[i]=sistemi[i];
  87.  
  88. }
  89. }
  90. Reporzitorium(const Reporzitorium &rp){
  91. strcpy(this->ime,rp.ime);
  92.  
  93.  
  94.  
  95. }
  96.  
  97.  
  98.  
  99.  
  100. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement