1 #include<string> 2 #include<iostream> 3 using namespace std; 4 enum Rank{i3,i5,i7}; 5 class CPU{ 6 public: 7 CPU(){} 8 int Getv(){ 9 return v; 10 } 11 float Getf(){ 12 return f; 13 } 14 Rank GetRank(){ 15 return r; 16 } 17 void Setv(int v){ 18 this->v=v; 19 } 20 void Setf(float f){ 21 this->f=f; 22 } 23 void Set(int r){ 24 this->r=(Rank)r; 25 } 26 void couting(){ 27 cout<<Getv()<<"伏¤¨¹特¬?\n"<<Getf()<<"赫?兹Á¨¨"<<endl; 28 switch (GetRank()){ 29 case i3:cout<<"i3"<<endl;break; 30 case i5:cout<<"i5"<<endl;break; 31 case i7:cout<<"i7"<<endl;break; 32 } 33 } 34 private: 35 int v; 36 float f; 37 Rank r; 38 }; 39 class ArrayOfCpu{ 40 public: 41 ArrayOfCpu(int size): size(size){ 42 cpuArray=new CPU[size]; 43 } 44 ArrayOfCpu(const ArrayOfCpu &a){ 45 size=a.size; 46 cpuArray=new CPU[size]; 47 for(int i=0;i<size;i++){ 48 cpuArray[i]=a.cpuArray[i]; 49 } 50 } 51 CPU &retu(int count){ 52 return cpuArray[count]; 53 } 54 ~ArrayOfCpu(){ 55 cout<<"删¦?除y数ºy组Á¨¦类¤¨¤........"<<endl; 56 delete[] cpuArray; 57 } 58 private : 59 CPU *cpuArray; 60 int size; 61 };
时间: 2024-11-15 00:51:02