diff options
| author | arthurtspears <[email protected]> | 2024-04-20 11:16:36 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-20 11:16:36 -0700 |
| commit | 659a1f12d935130bf8da4fe14165e4f421ac7c18 (patch) | |
| tree | cebf8ee2c18c8e0aa4cf5fc4630a8005164b068d /CST 126/Homework 1 | |
| parent | Added helpers.h file. (diff) | |
| download | homework-1-arthurtspears-develop.tar.xz homework-1-arthurtspears-develop.zip | |
* all work up until inclass practice
* Added Unit Tests Project
* Added second unit tests project as example.
* Bring up to date for merge
Diffstat (limited to 'CST 126/Homework 1')
| -rw-r--r-- | CST 126/Homework 1/GuessingGame.hpp | 22 | ||||
| -rw-r--r-- | CST 126/Homework 1/Homework 1.vcxproj | 7 | ||||
| -rw-r--r-- | CST 126/Homework 1/Homework 1.vcxproj.filters | 8 | ||||
| -rw-r--r-- | CST 126/Homework 1/helpers.hpp | 44 | ||||
| -rw-r--r-- | CST 126/Homework 1/main.cpp | 58 | ||||
| -rw-r--r-- | CST 126/Homework 1/menu.hpp | 55 |
6 files changed, 188 insertions, 6 deletions
diff --git a/CST 126/Homework 1/GuessingGame.hpp b/CST 126/Homework 1/GuessingGame.hpp new file mode 100644 index 0000000..fa0f85d --- /dev/null +++ b/CST 126/Homework 1/GuessingGame.hpp @@ -0,0 +1,22 @@ +#ifndef GUESSING_GAME_HPP +#define GUESSING_GAME_HPP + +#include "helpers.hpp" +#include <iostream> + +using std::cout; +using std::endl; + +inline void OutputRandomNumber() { + cout << Random(1, 10000) << endl; +} + + + + + +#endif // !GUESSING_GAME_HPP + + + + diff --git a/CST 126/Homework 1/Homework 1.vcxproj b/CST 126/Homework 1/Homework 1.vcxproj index 2941062..553addf 100644 --- a/CST 126/Homework 1/Homework 1.vcxproj +++ b/CST 126/Homework 1/Homework 1.vcxproj @@ -70,6 +70,9 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <IncludePath>.\;$(IncludePath)</IncludePath> + </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> @@ -130,7 +133,9 @@ <ClCompile Include="main.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="helpers.h" /> + <ClInclude Include="GuessingGame.hpp" /> + <ClInclude Include="helpers.hpp" /> + <ClInclude Include="menu.hpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/CST 126/Homework 1/Homework 1.vcxproj.filters b/CST 126/Homework 1/Homework 1.vcxproj.filters index 69746f6..a2e2650 100644 --- a/CST 126/Homework 1/Homework 1.vcxproj.filters +++ b/CST 126/Homework 1/Homework 1.vcxproj.filters @@ -20,7 +20,13 @@ </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="helpers.h"> + <ClInclude Include="helpers.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="menu.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="GuessingGame.hpp"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> diff --git a/CST 126/Homework 1/helpers.hpp b/CST 126/Homework 1/helpers.hpp new file mode 100644 index 0000000..8225722 --- /dev/null +++ b/CST 126/Homework 1/helpers.hpp @@ -0,0 +1,44 @@ +#ifndef HELPERS_HPP +#define HELPERS_HPP + +#include <random> + +typedef unsigned long long uLong; +typedef unsigned char BYTE; + +inline int Random(const int& lowest, const int& highest) +{ + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<int> dis(lowest, highest); + const int random_number = dis(gen); + return random_number; +} + +inline void GenerateRandomNumbers(int arrayToFill[], const int& size) +{ + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<int> dis(0, size); + for (auto i = 0; i < size; ++i) + { + const int random_number = dis(gen); + arrayToFill[i] = random_number; + } +} +inline int add(int num, char myChar) +{ + return num + myChar; +} +inline int add(int num, int num2, int num3) +{ + return num + num2 + num3; +} +inline int add(int num, int num2, int num3, int num4) +{ + return num + num2 + num3 + num4; +} + + + +#endif diff --git a/CST 126/Homework 1/main.cpp b/CST 126/Homework 1/main.cpp index dd21a1e..e223d37 100644 --- a/CST 126/Homework 1/main.cpp +++ b/CST 126/Homework 1/main.cpp @@ -1,13 +1,63 @@ // Name: Arthur Spears // Class: CST 126 // Date: 3/31/24 -// Assignment: Homework +// Assignment: Homework 1 #include <iostream> +#include "helpers.hpp" +#include "menu.hpp" +#include <bitset> -int main() { +using std::cout; +using std::endl; + +struct DailyTemperature +{ + int highTemp{}; + int lowTemp{}; +}; + +enum DayOfTheWeek +{ + Sunday = 0, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday = 6 +}; - std::cout << "Hello world"; +enum Month +{ + January = 1, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December +}; +struct Date +{ + Month month; + uint8_t day; + uint16_t year; +}; + +union FloatIntUnion +{ + float intFloat; + uint32_t uInt; +}; + +int main() { + return 0; -}
\ No newline at end of file +} diff --git a/CST 126/Homework 1/menu.hpp b/CST 126/Homework 1/menu.hpp new file mode 100644 index 0000000..31c9777 --- /dev/null +++ b/CST 126/Homework 1/menu.hpp @@ -0,0 +1,55 @@ +#ifndef MENU_H +#define MENU_H + +#include <iostream> +#include "GuessingGame.hpp" + +using std::cout; +using std::cin; +using std::endl; + +inline void DisplayMenu(const int& value) { + + cout << "***************************************************************" << endl; + cout << "Welcome to the menu!\n"; + cout << "1. Currency Converter\n"; + cout << "2. Guessing Game\n"; + cout << "3. Temperature Logger\n"; + cout << "5. Exit\n"; + cout << endl; + cout << "Please pick a number for your choice: "; +} + +inline void Worker() { + + int input = 0; + + DisplayMenu(input); + + cout << input; + + cin >> input; + + while (input != 5) + { + switch (input) { + case 1: + //Call Currency Function + break; + case 2: + //Call Guessing Game Function + OutputRandomNumber(); + break; + case 3: + //Call Temperature Logger + break; + default: + cout << "\nInvalid option, please pick again..\n"; + } + + DisplayMenu(input); + + cin >> input; + } +} +#endif
\ No newline at end of file |