backup before Testing out pointers on classes

This commit is contained in:
ganome 2025-01-28 18:47:32 -07:00
parent 22f6da97f4
commit 0b9ea99c8c
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
4 changed files with 25 additions and 16 deletions

View File

@ -1,9 +1,18 @@
void setCPU(){};
void setCPU(std::string model, float mainclock, float boostclock) {
mainclock = mainclock;
boostclock = boostclock;
void setCPU(std::string mmodel, float mmainclock, float mboostclock) {
A7800x3d.mainclock = mmainclock;
A7800x3d.boostclock = mboostclock;
// model.boostclock = boostclock; // This doesnt work because its not a vaild reference!
// Trying to use the local model var to call the global CPU class for that specific model
cout << "\n\n\n" << model << ".mainclock\n\n" << endl;
cout << "Coming from the setCPU function in setcpu.h" << endl;
cout << "\n\n\n" << mmodel << ".mainclock\n\n" << endl;
cout << "\n\n" << i75820k.boostclock << "\n\n" << endl;
cout << "Leaving setCPU()\n\n";
}
//void setCPU(CPU *mA7800x3d, double mmainclock) {
//mA7800x3d->mainclock = mmainclock;
//}

View File

@ -21,8 +21,8 @@ void a7800x3d(float mainclock, float boostclock){
// return mainclock, boostclock;
};
std::string a7800x3d(std::string man){
CPU A7800x3d;
A7800x3d.manufacturer = "AMD";
return man;
};
// std::string a7800x3d(std::string man){
// CPU A7800x3d;
// A7800x3d.manufacturer = "AMD";
// return man;
// };

View File

@ -47,9 +47,3 @@ CPU A7800x3d;
// Spawn a CPU class for the Intel i7 5820k
CPU Ii75820k;
// CPU A7800x3d;
// A7800x3d.manufacturer = "AMD";
// A7800x3d.ReleasedYear = 2024;
// A7800x3d.architecture = "Zen 4";
// A7800x3d.boostclock = 5.2;
// A7800x3d.mainclock = 4.8;

View File

@ -4,6 +4,8 @@
#include "lists/cpu.h"
#include "include/setcpu.h"
void* ptr = &A7800x3d;
int main() {
using namespace std;
@ -15,12 +17,16 @@ int main() {
i75820k.model = "i75820k";
i75820k.manufacturer = "Intel";
setCPU("i75820k", 3.2, 3.6);
setCPU("A7800x3d", 4.8, 5.2);
setCPU("i75820k", 3.2, 3.8);
// setCPU(A7800x3d, 4.8);
cout << "The " << A7800x3d.model << "'s Manufacturer is: " << A7800x3d.manufacturer << endl;
cout << "The Main Clock Speed is: " << A7800x3d.mainclock << endl;
cout << "The Boost Clock Speed is: " << A7800x3d.boostclock << endl;
cout << "\n\nThe pointer is: " << ptr << endl;
// cout << "The pointer is: " << *ptr.manufacturer << endl;
system("sleep 3s");
return 0;