From 3245f72ea310b3ea0f1035f60e86f41d8f0371e7 Mon Sep 17 00:00:00 2001 From: Jordan HarrisToovy Date: Mon, 18 Oct 2021 01:07:43 -0700 Subject: Temporary push for backup --- CST116 Lab3 Harris-Toovy.sln | 31 ++ CST116F2021-Lab3.sln | 31 -- CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp | 326 +++++++++++++++++++++ CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters | 22 ++ CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj | 147 ++++++++++ .../CST116 Lab3 Textual Work Harris-Toovy.txt | 27 ++ CST116F2021-Lab3/CST116F2021-Lab3.cpp | 20 -- CST116F2021-Lab3/CST116F2021-Lab3.vcxproj | 147 ---------- CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters | 22 -- CppProperties.json | 21 ++ 10 files changed, 574 insertions(+), 220 deletions(-) create mode 100644 CST116 Lab3 Harris-Toovy.sln delete mode 100644 CST116F2021-Lab3.sln create mode 100644 CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp create mode 100644 CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters create mode 100644 CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj create mode 100644 CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt delete mode 100644 CST116F2021-Lab3/CST116F2021-Lab3.cpp delete mode 100644 CST116F2021-Lab3/CST116F2021-Lab3.vcxproj delete mode 100644 CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters create mode 100644 CppProperties.json diff --git a/CST116 Lab3 Harris-Toovy.sln b/CST116 Lab3 Harris-Toovy.sln new file mode 100644 index 0000000..75668ad --- /dev/null +++ b/CST116 Lab3 Harris-Toovy.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31424.327 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116F2021-Lab3", "CST116F2021-Lab3\CST116 Lab3 Harris-Toovy.vcxproj", "{00A9D643-BD80-4D4E-8CEA-64711FD96DAC}" +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 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x64.ActiveCfg = Debug|x64 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x64.Build.0 = Debug|x64 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x86.ActiveCfg = Debug|Win32 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x86.Build.0 = Debug|Win32 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x64.ActiveCfg = Release|x64 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x64.Build.0 = Release|x64 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x86.ActiveCfg = Release|Win32 + {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E9EEF905-246F-4906-9C1F-8DE00CEB16AD} + EndGlobalSection +EndGlobal diff --git a/CST116F2021-Lab3.sln b/CST116F2021-Lab3.sln deleted file mode 100644 index 346b5fd..0000000 --- a/CST116F2021-Lab3.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31424.327 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116F2021-Lab3", "CST116F2021-Lab3\CST116F2021-Lab3.vcxproj", "{00A9D643-BD80-4D4E-8CEA-64711FD96DAC}" -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 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x64.ActiveCfg = Debug|x64 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x64.Build.0 = Debug|x64 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x86.ActiveCfg = Debug|Win32 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Debug|x86.Build.0 = Debug|Win32 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x64.ActiveCfg = Release|x64 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x64.Build.0 = Release|x64 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x86.ActiveCfg = Release|Win32 - {00A9D643-BD80-4D4E-8CEA-64711FD96DAC}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E9EEF905-246F-4906-9C1F-8DE00CEB16AD} - EndGlobalSection -EndGlobal diff --git a/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp new file mode 100644 index 0000000..dc999dc --- /dev/null +++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp @@ -0,0 +1,326 @@ +//Code by Jordan Harris-Toovy for OIT's CST116 course. October 2021 + +#include +#include +using namespace std; + +//7.2 - Learn by doing exercises #1 + +/* +int main() +{ + float money = 0.0F; + bool has_checkings = 0; + bool has_savings = 0; + + cout << "Please enter the amout of money you have (in USD): \n"; + cin >> money; + + cout << "Do you have a checkings account (enter 0 for no, 1 for yes): \n"; + cin >> has_checkings; + + cout << "Do you have a savings account (enter 0 for no, 1 for yes): \n"; + cin >> has_savings; + + cout << "\n\n"; + cout << "Your account type is: "; + + if (money >= 25000) + cout << "Platnum" << endl; + else if (money >= 10000) + { + if (has_checkings == 1 && has_savings == 1) + cout << "Gold" << endl; + else if ((has_checkings == 1 && has_savings == 0) || (has_checkings == 0 && has_savings == 1)) + cout << "Silver" << endl; + else + { + cout << "Error" << endl; + return 1; + } + } + else + cout << "Copper" << endl; + + return 0; +} +*/ + +//7.4 - Learn by doing exercises #1 + +/* +int main() +{ + cout << "Student Grade Program\n" << " -Main Menu-" << "\n\n"; + cout << "1. Enter name\n"; + cout << "2. Enter test scores\n"; + cout << "3. Display test scores\n"; + cout << "9. Exit\n\n"; + cout << "Please enter your choice from the list above: "; + + int user_input = 0; + cin >> user_input; + + cout << "\n"; + + switch (user_input) + { + case 1: + cout << "This is where you would enter a name if this was more then a menu!\n"; + break; + case 2: + cout << "This is where you would enter a test score if this was more then a menu!\n"; + break; + case 3: + cout << "This is where you would see test scores if this was more then a menu!\n"; + break; + case 9: + cout << "Goodbye\n"; + break; + default: + cout << "Invalid input. Exiting\n"; + return 1; + } + + return 0; +} +*/ + +//7.10 - Programing exercises #2 + +//Pesudocode: +/* +DISPLAY promt for interest rate +GET interest rate from user + +DISPLAY promt for loan amount +GET loan amount from user + +IF interest rate is out of range +DISPLAY error message + +IF loan amount is out of range +DISPLAY error message + +IF loan amount is greater than the threshold +MOVE high fee into varible charge +OTHERWISE +MOVE low fee into varible charge + +Calculate the interest of the loan amount and add it to varible charge + +DISPLAY charge +*/ + +/* +int main() +{ + float interest_rate = -1.00F; + float principal = -1.00F; + float fee = 0.00F; + float payment = -1.00F; + + cout << "Enter the interest rate (in percent) of the loan: "; + cin >> interest_rate; + + cout << "\nEnter the principal (in USD) of the loan: "; + cin >> principal; + cout << endl; + + if (interest_rate > 18) + { + cout << "Interest rate is too high\n"; + return (1); + } + else if (interest_rate < 1) + { + cout << "Interest rate is too low\n"; + return (2); + } + + if (principal > 1000.00F) + { + cout << "Principal is too large\n"; + return (3); + } + else if (principal < 100.00F) + { + cout << "Principal is too small\n"; + return (4); + } + + if (principal > 500.00F) + fee = 25.00F; + else + fee = 20.00F; + + payment = principal * (interest_rate / 100); + payment += fee; + + cout << "\n\nThe payment due for this billing cycle is "; + cout.setf(ios::fixed); + cout.setf(ios::showpoint); + cout.precision(2); + cout << payment << " USD\n"; + + return (0); +} +*/ + +//8.2 - Learn by doing exercises #1 + +int main() +{ + int max_value = -1; + + cout << "Enter an interger between 1 and 50: "; + cin >> max_value; + + //Filter invalid input + if ((max_value < 1) || (max_value > 50)) + { + cout << "\n Invalid input"; + return (1); + } + + cout << "The even numbers between " << max_value << " and 0 are: " << endl; + + //Check if even, remove 1 if not + if ((max_value % 2) != 0) + { + max_value--; + } + + while (max_value >= 0) + { + cout << max_value << endl; + max_value -= 2; + } + + return (0); +} + +//8.4 - Learn by doing exercises #1 + +//Pseudocode: +/* +* DISPLAY loop-length prompt +* GET num_asign +* +* FOR num_asign: +* DISPLAY score prompt +* GET num_asign, ADD to scores +* +* DIVIDE scores by num_asign +* DISPLAY scores +*/ + +/* +int main() +{ + unsigned int num_asign = 0; + float score = 0.0F, temp_score = 0.0F; + + cout << "Enter the number of asignments: "; + cin >> num_asign; + cout << "\nEnter each score as a percent.\n\n"; + + for (int idx = 0; idx < num_asign; idx++) + { + cout << "Enter score " << idx + 1 << " : "; + cin >> temp_score; + score += temp_score; + cout << endl; + } + + score = score / num_asign; + + cout << "The average score is: " << score << endl; + + return (0); +} +*/ + +//8.4 - Learn by doing exercises #2 (NOT IN PROBLEM SET) + +/* +int main() +{ + int tri_height = 0; + cout << "Enter size of triangle: "; + cin >> tri_height; + cout << endl; + + if (tri_height > 0) + { + tri_height--; + } + else + { + cout << "Invalid size"; + return (1); + } + + for (tri_height; tri_height >= 0; tri_height--) + { + for (int tri_width = tri_height; tri_width >= 0; tri_width--) + cout << "* "; + cout << endl; + } + return (0); +} +*/ + +//8.10 - Programing exercises #3 + +//Pseudocode: +/* +* DISPLAY user prompt for maximum sequence value +* GET max_value +* +* IF max_value < 1, end +* ELSE IF max_value = 1, DISPLAY 1, 1 +* ELSE: +* +* DISPLAY 1, 1, 2 +* working_v1 = 1 +* working_v2 = 2 +* working_v3 = 2 +* +* WHILE working_v3 < max_value: +* +* working_v3 = working_v1 + working_v2 +* working_v1 = working_v2 +* working_v2 = working_v3 +* +* DISPLAY working_v3 +*/ + +/* +int main() +{ + unsigned long long max_val = 0, working_v1 = 1, working_v2 = 1, working_v3 = 2; + + cout << "Enter maximum positive integer for the Fibonacci sequence: "; + cin >> max_val; + cout << endl; + + if (max_val == 0) + cout << "Not in sequence" << endl; + else + { + cout << "1\n1" << endl; + while (working_v3 < max_val) + { + cout << working_v3 << endl; + working_v3 = working_v1 + working_v2; + working_v1 = working_v2; + working_v2 = working_v3; + } + cout << endl; + } + + return (0); +} +*/ + diff --git a/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters new file mode 100644 index 0000000..1a7ae88 --- /dev/null +++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj new file mode 100644 index 0000000..6f63d0c --- /dev/null +++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {00a9d643-bd80-4d4e-8cea-64711fd96dac} + CST116F2021Lab3 + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt b/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt new file mode 100644 index 0000000..927750d --- /dev/null +++ b/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt @@ -0,0 +1,27 @@ +This file contains all work not applicable to being answered in code/output form. + +6.4 Exercises #1: +0 +2 +3 +3 +2 + + +7.1 Exercises #1-6: +1) Wrong syntax - should be: int_exp1 >= int_exp2 +2) Not a conditional - should be: int_exp1 == int_exp2 (unless you wanted an assignemnt) +3) Wrong syntax - should be: int_exp1 != int_exp2 +4) "A" is a string, will always evaluate to false - should be: char_exp == 'A' +5) Mismatched data type - should be: int_exp1 > 66 for clarity (66 is the decimal value of 'B'), although it should work +6 Wrong syntax - should be: (int_exp1 < 2) && (int_exp1 > -10) + + +6.5 Exercises #1-5: +1) a += 25 +2) b *= (a * 2) +3) b++ +4) c %= 5 +5) b /= a + + diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp deleted file mode 100644 index 41af613..0000000 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// CST116F2021-Lab3.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - -#include - -int main() -{ - std::cout << "Hello World!\n"; -} - -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu - -// Tips for Getting Started: -// 1. Use the Solution Explorer window to add/manage files -// 2. Use the Team Explorer window to connect to source control -// 3. Use the Output window to see build output and other messages -// 4. Use the Error List window to view errors -// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project -// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj deleted file mode 100644 index a706d70..0000000 --- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {00a9d643-bd80-4d4e-8cea-64711fd96dac} - CST116F2021Lab3 - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters deleted file mode 100644 index 1a7ae88..0000000 --- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/CppProperties.json b/CppProperties.json new file mode 100644 index 0000000..659bf4e --- /dev/null +++ b/CppProperties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "inheritEnvironments": [ + "msvc_x86" + ], + "name": "x86-Debug", + "includePath": [ + "${env.INCLUDE}", + "${workspaceRoot}\\**" + ], + "defines": [ + "WIN32", + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "windows-msvc-x86" + } + ] +} \ No newline at end of file -- cgit v1.2.3