Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- enum Tip{LINUX,UNIX,WINDOWS};
- class OperativenSisten{
- private:
- char *ime[];
- float version;
- Tip t;
- float GB;
- public:
- OperativenSistem(){}//DEFAULT CONSTRUCTOR
- OperativenSistem(const char *ime,const float version=0.0,Tip t=(Tip) 0,const float GB=0.0){//CONSTRUCTOR SO ARGUMENTI
- this->ime=new char[strlen(ime)+1];
- strcpy(this->ime,ime);
- this->version=version;
- Tip t=t;
- this->GB=GB;
- }
- OperativenSistem(const OperativenSistem& os){
- this->ime=new char[strlen(os.ime]+1];
- strcpy(this->ime,os.ime);
- this->version=os.version;
- Tip t=os.t;
- this->GB=os.GB;
- }
- OperativenSistem &operator=(const OperativenSistem &os){
- if(this!=&os){
- delete [] ime;
- this->ime=new char[strlen(os.ime)+1];
- strcpy(this->ime,os.ime);
- this->version=os.version;
- Tip t=os.t;
- this->GB=os.GB;
- }
- return *this;
- }
- ~OperativenSistem(){
- delete [] ime;
- }
- void pecati(){
- //Ime: Ubuntu Verzija: 16.04 Tip: 1 Golemina:1.25GB
- cout<<"Ime: "<<ime<<"Verzija: "<<version<<"Tip: "<<t<<"Golemina: "<<GB<<"GB"<<endl;
- }
- bool ednakviSe(const OperativenSistem &os){
- if(strcmp(this->ime,os.ime==0) && this->version==os.version && this->t==os.t && this->GB==GB){
- return true;
- }
- else
- return false;
- }
- int sporediVerzija(const OperativenSistem &os){
- if(this->version==os.version)
- return 0;
- else if(this->version>os.version){
- return -1;
- else
- return 1;
- }
- }
- bool istaFamilija(const OperativenSistem &sporedba){
- if(strcmp(this->ime,os.ime==0) && this->t==t;){
- return true;
- else
- return false;
- }
- }
- };
- class Repozitorium{
- private:
- char ime[20];
- OperativenSistem *sistemi;
- int brojOS;
- public:
- Reporzitorium(){}//DEFAULT CONSTRUCTOR
- Reporzitorium(const char *ime,OperativenSistem *sistemi,int brojOS){//CONSTRUCTOR SO ARGUMENTI
- strcpy(this->ime,ime);
- this->brojOS=brojOS;
- this->sistemi= new OperativenSistem[brojOS];
- for(int i=0;i<brojOS;++i){
- this->sistemi[i]=sistemi[i];
- }
- }
- Reporzitorium(const Reporzitorium &rp){
- strcpy(this->ime,rp.ime);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement