Sort of fixed the Classes - now I need to make a for loop inside a

function that creates a CPU class for every listed CPU type
This commit is contained in:
ganome 2025-01-28 15:24:46 -07:00
parent cae63ebe2a
commit 096e8ad559
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
2 changed files with 30 additions and 15 deletions

View File

@ -12,7 +12,7 @@ class Hardware {
class CPU: public Hardware { class CPU: public Hardware {
public: public:
bool Bit64; bool bits64;
int cores; int cores;
int threads; int threads;
int pcielanes; int pcielanes;
@ -22,16 +22,30 @@ class CPU: public Hardware {
std::string architecture; std::string architecture;
std::string memoryrange; std::string memoryrange;
std::string getmanufacturer(std::string manufacturer){ CPU() {
return manufacturer; manufacturer = "Intel";
model = "default";
ReleasedYear = 2000;
bits64 = true;
cores = 4;
threads = 2;
pcielanes = 24;
maxram = 128;
mainclock = 2;
boostclock = 2.2;
architecture = "x86_64";
memoryrange = "00:00";
};
void getmanufacturer(std::string manufacturer){
cout << manufacturer;
}; };
}; };
// std::string a7800x3d(std::string man){ // Spawn a CPU class for the Ryzen 7 7800x3d
// CPU A7800x3d; CPU A7800x3d;
// A7800x3d.manufacturer = "AMD"; // Spawn a CPU class for the Intel i7 5820k
// return man; CPU Ii75820k;
// };
// CPU A7800x3d; // CPU A7800x3d;
// A7800x3d.manufacturer = "AMD"; // A7800x3d.manufacturer = "AMD";

View File

@ -3,13 +3,13 @@
#include "lists/hardware.h" #include "lists/hardware.h"
#include "lists/cpu.h" #include "lists/cpu.h"
/*
void setupCPU(std::string model, float mainclock, int cores){ void setupCPU(std::string model, float mainclock, int cores){
i75820k.model = model; i75820k.model = model;
i75820k.mainclock = mainclock; i75820k.mainclock = mainclock;
i75820k.cores = cores; i75820k.cores = cores;
}; };
// */
int main() { int main() {
@ -27,13 +27,14 @@ int main() {
// a7800x3d(); // a7800x3d();
// a7800x3d(4.8, 5.2); // a7800x3d(4.8, 5.2);
setupCPU("i75820k", 3.2, 6); /* setupCPU("i75820k", 3.2, 6);
cout << "cores: " << i75820k.cores << endl; cout << "cores: " << i75820k.cores << endl;
cout << "manufacturer: " << i75820k.manufacturer << endl;
*/
// cout << "Setting 7800x3d Manufacturer to AMD : " << a7800x3d("test") << endl; A7800x3d.manufacturer = "AMD";
// cout << "Setting the clock speeds to: Main: " << a7800x3d(4.8,5.2) << endl; A7800x3d.model = "Ryzen 7 7800x3d";
cout << "The " << A7800x3d.model << "'s Manufacturer is: " << A7800x3d.manufacturer << endl;
// cout << "The Manufacturer is: " << A7800x3d.manufacturer << endl;
// cout << "The Main Clock Speed is: " << A7800x3d.mainclock << endl; // cout << "The Main Clock Speed is: " << A7800x3d.mainclock << endl;
// cout << "The Boost Clock Speed is: " << A7800x3d.boostclock << endl; // cout << "The Boost Clock Speed is: " << A7800x3d.boostclock << endl;