From cae63ebe2aaf3da2d86e2d4c46132644f7636743 Mon Sep 17 00:00:00 2001 From: ganome Date: Tue, 28 Jan 2025 13:38:55 -0700 Subject: [PATCH] Moved CPU declarations back into main. --- lists/cpu.h | 16 +++++++++++++--- lists/hardware.h | 1 + main.cpp | 20 ++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lists/cpu.h b/lists/cpu.h index 8adbce2..f30cbf0 100644 --- a/lists/cpu.h +++ b/lists/cpu.h @@ -1,14 +1,24 @@ #pragma once #include "hardware.h" +using namespace std; + +CPU i75820k; -void a7800x3d(){CPU A7800x3d;}; +// Testing a function to create the class - cant access the class from main function though. +void a7800x3d(){ + CPU A7800x3d; + cout << "Initial Main Clock: " << A7800x3d.mainclock << "\n" << A7800x3d.boostclock << endl; +}; -float a7800x3d(float mainclock, float boostclock){ +void a7800x3d(float mainclock, float boostclock){ CPU A7800x3d; A7800x3d.mainclock = mainclock; A7800x3d.boostclock = boostclock; - return mainclock,boostclock; + + std::cout << "Main clock is: " << A7800x3d.mainclock << "\nBoost clock is: " << A7800x3d.boostclock << endl; + + // return mainclock, boostclock; }; std::string a7800x3d(std::string man){ diff --git a/lists/hardware.h b/lists/hardware.h index 28e52b8..141c1a6 100644 --- a/lists/hardware.h +++ b/lists/hardware.h @@ -20,6 +20,7 @@ class CPU: public Hardware { float mainclock; float boostclock; std::string architecture; + std::string memoryrange; std::string getmanufacturer(std::string manufacturer){ return manufacturer; diff --git a/main.cpp b/main.cpp index 9e6afc9..b029205 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,14 @@ #include "lists/hardware.h" #include "lists/cpu.h" +void setupCPU(std::string model, float mainclock, int cores){ + i75820k.model = model; + i75820k.mainclock = mainclock; + i75820k.cores = cores; +}; +// + + int main() { using namespace std; @@ -15,11 +23,15 @@ int main() { A7800x3d.boostclock = 5.2; A7800x3d.mainclock = 4.8; */ -// referencing the function a7800x3d from cpu.h - a7800x3d("AMD"); +// referencing the function a7800x3d from cpu.h and initialize the class + // a7800x3d(); + // a7800x3d(4.8, 5.2); - cout << "Setting 7800x3d Manufacturer to AMD : " << a7800x3d("test") << endl; - cout << "Setting the clock speeds to: Main: " << a7800x3d(4.8,5.2) << endl; +setupCPU("i75820k", 3.2, 6); + cout << "cores: " << i75820k.cores << endl; + + // cout << "Setting 7800x3d Manufacturer to AMD : " << a7800x3d("test") << endl; + // cout << "Setting the clock speeds to: Main: " << a7800x3d(4.8,5.2) << endl; // cout << "The Manufacturer is: " << A7800x3d.manufacturer << endl; // cout << "The Main Clock Speed is: " << A7800x3d.mainclock << endl;