CPU类(类的设计)

#include
using namespace std;

enum CPU_Rank{P1=1,P2,P3,P4,P5,P6,P7};
class CPU
{
private:
		CPU_Rank rank;
		int frequency;
		float voltage;
public:
	void SetRank(CPU_Rank r){rank=r;
	}
	void SetFrequency(int f){frequency=f;
	} 
	void SetVoltage(float v){voltage=v;
	}
	CPU_Rank GetRank()
	{return rank;
	}
	int GetFrequency(){return frequency;
	}
	int GetVoltage(){return voltage;
	}
	CPU(CPU_Rank r=P1,int f=1000,float v=220.5);
	void Run(){
		cout<<"CPU Run!"<CPU类(类的设计)_第1张图片

你可能感兴趣的:(c语言,c++,c++,开发语言)