diff options
| author | KaedenGrubb <[email protected]> | 2021-11-02 12:38:10 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-02 12:38:10 -0700 |
| commit | ac9686002ce8f03a7c297420081bbcab2e45650a (patch) | |
| tree | 74a112a0815d0fb7b2bca2dfb12c0279b31dbe45 | |
| parent | Add files via upload (diff) | |
| download | cst116proj2-1-kaeden-g-and-james-l-project-2-ac9686002ce8f03a7c297420081bbcab2e45650a.tar.xz cst116proj2-1-kaeden-g-and-james-l-project-2-ac9686002ce8f03a7c297420081bbcab2e45650a.zip | |
Add files via upload
5 files changed, 379 insertions, 0 deletions
diff --git a/Project 2 (Combined Code)/Project 2 (Combined Code).sln b/Project 2 (Combined Code)/Project 2 (Combined Code).sln new file mode 100644 index 0000000..023a82e --- /dev/null +++ b/Project 2 (Combined Code)/Project 2 (Combined Code).sln @@ -0,0 +1,31 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31729.503
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project 2 (Combined Code)", "Project 2 (Combined Code)\Project 2 (Combined Code).vcxproj", "{ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Debug|x64.ActiveCfg = Debug|x64
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Debug|x64.Build.0 = Debug|x64
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Debug|x86.ActiveCfg = Debug|Win32
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Debug|x86.Build.0 = Debug|Win32
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Release|x64.ActiveCfg = Release|x64
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Release|x64.Build.0 = Release|x64
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Release|x86.ActiveCfg = Release|Win32
+ {ACABB523-AEF7-4FA1-8A47-1DF0BAE8EB96}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {86FFAA74-8F45-4C82-A436-4C63988ACF44}
+ EndGlobalSection
+EndGlobal
diff --git a/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).cpp b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).cpp new file mode 100644 index 0000000..da29883 --- /dev/null +++ b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).cpp @@ -0,0 +1,175 @@ +#include <iostream>
+using namespace std;
+
+//Kaeden's code
+int GetData();
+int GetData();
+void IsOddEven(int number);
+int FindNumDigits(int number);
+int FindDigitAtPosition(int number, int Position);
+void DisplayMultiplicationTable();
+
+//James' code
+void DisplayMenu(int& menuChoice);
+void ProcessMenuChoice(int menuChoice, int& number);
+void IsPosNeg(int number);
+void DisplayAdditionTable();
+
+//James' code
+int main()
+{
+ //local variables
+ int number = 0;
+ int menuChoice = 0;
+ //get number from GetData
+ number = GetData();
+ //call DisplayMenu
+ DisplayMenu(menuChoice);
+ //call ProcessMenuChoice
+ ProcessMenuChoice(menuChoice, number);
+}
+
+
+//Kaeden's code
+int GetData()
+{
+ int number;
+ cout << "Enter Number:";
+ cin >> number;
+ return number;
+}
+
+//Kaeden's code
+void IsOddEven(int number)
+{
+ number %= 2;
+ if (number == 1)
+ cout << "The number is odd\n";
+ else
+ cout << "The number is even\n";
+}
+//Kaeden's code
+int FindNumDigits(int number)
+{
+ int Digit = 1;
+ for (int i = 0; abs(number) >= 10; i++)
+ {
+ number /= 10;
+ Digit += 1;
+ }
+
+ return Digit;
+}
+//Kaeden's code
+int FindDigitAtPosition(int number, int Position)
+{
+ int Digit;
+ int Finder = pow(10.0, Position);
+ int Operator = pow(10.0, Position - 1);
+ Digit = number % Finder;
+ Digit /= Operator;
+ return Digit;
+}
+//Kaeden's code
+void DisplayMultiplicationTable()
+{
+ cout << "| 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12|\n";
+ cout << "| 1| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12|\n";
+ cout << "| 2| 2| 4| 6| 8|10|12|14|16| 18| 20| 22| 24|\n";
+ cout << "| 3| 3| 6| 9|12|15|18|21|24| 27| 30| 33| 36|\n";
+ cout << "| 4| 4| 8|12|16|20|24|28|32| 36| 40| 44| 48|\n";
+ cout << "| 5| 5|10|15|20|25|30|35|40| 45| 50| 55| 60|\n";
+ cout << "| 6| 6|12|18|24|30|36|42|48| 54| 60| 66| 72|\n";
+ cout << "| 7| 7|14|21|28|35|42|49|56| 63| 70| 77| 84|\n";
+ cout << "| 8| 8|16|24|32|40|48|56|64| 72| 80| 88| 96|\n";
+ cout << "| 9| 9|18|27|36|14|15|16|17| 16| 90| 99|108|\n";
+ cout << "|10|10|20|30|40|50|60|70|80| 90|100|110|120|\n";
+ cout << "|11|11|22|33|44|55|66|77|88| 99|110|121|132|\n";
+ cout << "|12|12|24|30|48|60|72|84|96|108|120|132|144|\n";
+}
+
+//James' code
+void DisplayMenu(int& menuChoice)
+{
+ do {
+ cout << "To pick from the menu, press the number next to an option.\n" << endl
+ << "1. Is your number positive or negative?\n"
+ << "2. Is your number odd or even?\n"
+ << "3. How many digits are in your number?\n"
+ << "4. Choose specific degit\n"
+ << "5. See addition table\n"
+ << "6. See multiplication table\n"
+ << "7. Exit\n" << endl;
+
+ cin >> menuChoice;
+
+ if (menuChoice < 1 || menuChoice > 7)
+ {
+ cout << "Error: no available option has your number. Please try again.\n" << endl;
+ }
+ } while (menuChoice < 1 || menuChoice > 7);
+}
+
+//James' code
+void ProcessMenuChoice(int menuChoice, int& number)
+{
+ int Position = 0;
+ switch (menuChoice)
+ {
+ case 1:
+ IsPosNeg(number);
+ break;
+ case 2:
+ IsOddEven(number);
+ break;
+ case 3:
+ FindNumDigits(number);
+ break;
+ case 4:
+ FindDigitAtPosition(number, Position);
+ break;
+ case 5:
+ //call DisplayAdditionTable
+ break;
+ case 6:
+ DisplayMultiplicationTable();
+ case 7:
+ void exit();
+ break;
+ }
+}
+
+//James' code
+void IsPosNeg(int number)
+{
+ if (number < 0)
+ {
+ cout << "Your number is negative.\n";
+ }
+ else if (number > 0)
+ {
+ cout << "Your number is positive.\n";
+ }
+ else
+ {
+ cout << "Your number is 0, neither positive nor negative.\n";
+ }
+}
+
+//James' code
+void DisplayAdditionTable()
+{
+ cout << "| 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|\n";
+ cout << "| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|\n";
+ cout << "| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|\n";
+ cout << "| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|\n";
+ cout << "| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|\n";
+ cout << "| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|\n";
+ cout << "| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|\n";
+ cout << "| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|\n";
+ cout << "| 8| 9|10|11|12|13|14|15|16|17|18|19|20|\n";
+ cout << "| 9|10|11|12|13|14|15|16|17|18|19|20|21|\n";
+ cout << "|10|11|12|13|14|15|16|17|18|19|20|21|22|\n";
+ cout << "|11|12|13|14|15|16|17|18|19|20|21|22|23|\n";
+ cout << "|12|13|14|15|16|17|18|19|20|21|22|23|24|\n";
+}
\ No newline at end of file diff --git a/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj new file mode 100644 index 0000000..1af0468 --- /dev/null +++ b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>16.0</VCProjectVersion>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectGuid>{acabb523-aef7-4fa1-8a47-1df0bae8eb96}</ProjectGuid>
+ <RootNamespace>Project2CombinedCode</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <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|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="Project 2 (Combined Code).cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.filters b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.filters new file mode 100644 index 0000000..ab3ea85 --- /dev/null +++ b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Project 2 (Combined Code).cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.user b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.user new file mode 100644 index 0000000..0f14913 --- /dev/null +++ b/Project 2 (Combined Code)/Project 2 (Combined Code)/Project 2 (Combined Code).vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project>
\ No newline at end of file |