diff options
| author | Jordan HarrisToovy <[email protected]> | 2021-10-15 12:58:26 -0700 |
|---|---|---|
| committer | Jordan HarrisToovy <[email protected]> | 2021-10-15 12:58:26 -0700 |
| commit | 48ae333852499b3bdb44e81c6eff32f7ede9c965 (patch) | |
| tree | a00ba6e9d92bb9ea8e3a1c4cdb3314ef0914ff34 | |
| parent | Initial commit (diff) | |
| download | cst116-proj1-jordanht-oit-48ae333852499b3bdb44e81c6eff32f7ede9c965.tar.xz cst116-proj1-jordanht-oit-48ae333852499b3bdb44e81c6eff32f7ede9c965.zip | |
Base code finished
| -rw-r--r-- | CST116 Project 1 Harris-Toovy.sln (renamed from CST116F2021-Proj1.sln) | 0 | ||||
| -rw-r--r-- | CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.cpp | 44 | ||||
| -rw-r--r-- | CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.filters (renamed from CST116F2021-Proj1/CST116F2021-Proj1.vcxproj.filters) | 0 | ||||
| -rw-r--r-- | CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.vcxproj (renamed from CST116F2021-Proj1/CST116F2021-Proj1.vcxproj) | 2 | ||||
| -rw-r--r-- | CST116F2021-Proj1/CST116F2021-Proj1.cpp | 20 | ||||
| -rw-r--r-- | CppProperties.json | 21 |
6 files changed, 66 insertions, 21 deletions
diff --git a/CST116F2021-Proj1.sln b/CST116 Project 1 Harris-Toovy.sln index 0983236..0983236 100644 --- a/CST116F2021-Proj1.sln +++ b/CST116 Project 1 Harris-Toovy.sln diff --git a/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.cpp b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.cpp new file mode 100644 index 0000000..1e461b5 --- /dev/null +++ b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.cpp @@ -0,0 +1,44 @@ +//Code by Jordan Harris-Toovy for OIT's CST116 course, October 2021 + +/* +* Pseudocode: +* DISPLAY Prompt for radius +* GET user input, put into variable radius +* +* DISPLAY Prompt for height +* GET user input, put into variable height +* +* Calculate volume, put into variable volume +* DISPLAY Prompt for volume +*/ + +#include <iostream> +#include <iomanip> + +int main() +{ + float radius = 0.0F, height = 0.0F, volume = 0.0F, pi = 3.14159265359F; + + //Get values from user + std::cout << "Cylinder volume calculator MK1\n" << "Enter the radius of the cylinder: "; + std::cin >> radius; + + std::cout << "\nEnter the height of the cylinder: "; + std::cin >> height; + + //Exit if either input is less then zero + if ((radius < 0) || (height < 0)) + { + std::cout << "\nInvald input\n"; + return (1); + } + + //Calculate volume + volume = height * pi * radius * radius; + + //Display the volume + std::cout.setf(std::ios::fixed); + std::cout << "\n\nThe volume of the cylinder is: " << std::setprecision(2) << volume << std::endl; + + return (0); +} diff --git a/CST116F2021-Proj1/CST116F2021-Proj1.vcxproj.filters b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.filters index 96bd064..96bd064 100644 --- a/CST116F2021-Proj1/CST116F2021-Proj1.vcxproj.filters +++ b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.filters diff --git a/CST116F2021-Proj1/CST116F2021-Proj1.vcxproj b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.vcxproj index acf4e53..c292f38 100644 --- a/CST116F2021-Proj1/CST116F2021-Proj1.vcxproj +++ b/CST116F2021-Proj1/CST116 Project 1 Harris-Toovy.vcxproj @@ -139,7 +139,7 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="CST116F2021-Proj1.cpp" /> + <ClCompile Include="CST116 Project 1 Harris-Toovy.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/CST116F2021-Proj1/CST116F2021-Proj1.cpp b/CST116F2021-Proj1/CST116F2021-Proj1.cpp deleted file mode 100644 index 8bcb373..0000000 --- a/CST116F2021-Proj1/CST116F2021-Proj1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// CST116F2021-Proj1.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - -#include <iostream> - -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/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 |