summaryrefslogtreecommitdiff
path: root/BlankConsoleLab
diff options
context:
space:
mode:
authorEdwardFine <[email protected]>2022-11-08 23:49:55 -0800
committerEdwardFine <[email protected]>2022-11-08 23:49:55 -0800
commita4d3d1bbc10f1aecf2fb5cba6f2a82dd23fde5ab (patch)
tree47ee0e47f6219ee0f6c97377bb75e1632f1a383a /BlankConsoleLab
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-lab2-edwardfine-a4d3d1bbc10f1aecf2fb5cba6f2a82dd23fde5ab.tar.xz
cst116-lab2-edwardfine-a4d3d1bbc10f1aecf2fb5cba6f2a82dd23fde5ab.zip
1
Diffstat (limited to 'BlankConsoleLab')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp16
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj10
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj.filters2
-rw-r--r--BlankConsoleLab/CST116-Lab2-Edward-Fine-PseudoCode.txt5
-rw-r--r--BlankConsoleLab/CST116-Lab2-Edward-Fine.cpp64
5 files changed, 75 insertions, 22 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
deleted file mode 100644
index ed5f807..0000000
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
-
-#include <iostream>
-
-using namespace std;
-
-using std::cout;
-using std::cin;
-using std::endl;
-
-int main()
-{
- cout << "Hello World!\n";
-}
-
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj
index db2e734..d15e62e 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj
@@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</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>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -139,7 +139,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp" />
+ <ClCompile Include="CST116-Lab2-Edward-Fine.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
index aca1dd9..b10efac 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
@@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp">
+ <ClCompile Include="CST116-Lab2-Edward-Fine.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/BlankConsoleLab/CST116-Lab2-Edward-Fine-PseudoCode.txt b/BlankConsoleLab/CST116-Lab2-Edward-Fine-PseudoCode.txt
new file mode 100644
index 0000000..7f6fd62
--- /dev/null
+++ b/BlankConsoleLab/CST116-Lab2-Edward-Fine-PseudoCode.txt
@@ -0,0 +1,5 @@
+Figure out if the user is inputting in celcius or fahrenheit.
+prompt the user to input their respected temperature. If it was inputted into celcius, convert to fahrenheit.
+Ask the user for the wind speed.
+Using the two values given, calulate the wind chill.
+Display the windchill to the user. \ No newline at end of file
diff --git a/BlankConsoleLab/CST116-Lab2-Edward-Fine.cpp b/BlankConsoleLab/CST116-Lab2-Edward-Fine.cpp
new file mode 100644
index 0000000..dd14e20
--- /dev/null
+++ b/BlankConsoleLab/CST116-Lab2-Edward-Fine.cpp
@@ -0,0 +1,64 @@
+// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+#include <tgmath.h>
+
+using namespace std;
+
+using std::cout;
+using std::cin;
+using std::endl;
+void convertToF(int *c);
+float getChill(int speed, int chill);
+
+int main()
+{
+ char temp = 'f';
+ int degree=122;
+ int windSpeed = 232;
+ float windChill;
+ cout << "Are you inputting temperature in celcius or fahrenheit? C/f? ";
+ cin >> temp;
+ if (temp == 'c' || temp == 'C') {
+ while (degree < -62 || degree > 49.5) {
+ cout << "What is your temperature in celcius from -62 to 49.5 degrees? ";
+ cin >> degree;
+ }
+ convertToF(&degree);
+ }
+ else if (temp == 'f' || temp == 'F') {
+ while (degree < -80 || degree > 121) {
+ cout << "What is your temperature in fahrenheit from -80 to 121 degrees? ";
+ cin >> degree;
+ }
+ }
+ while (windSpeed < 0 || windSpeed > 231) {
+ cout << "Please input the wind speed in MPH: ";
+ cin >> windSpeed;
+ }
+ windChill = getChill(degree, windSpeed);
+ cout << "The windchill for " << degree << " degrees Fahrenheit and " << windSpeed << " mph winds is " << windChill;
+
+
+}
+//this convertToF function serves to convert any celcius input to Fahrenheit by taking the input of the degree given and
+//performing an algebraic function to convert it. It returns no value because it overwrites the original variable's value.
+void convertToF(int *c) {
+ cout << "Converting Celcius to Farhrenheit..."<< endl;
+ *c = 9 / 5 * *c + 32;
+ return;
+}
+//This getChill function serves to calculate the windchill. I had seperated them all out into segments because I was having
+//trouble calulating it right and though it was an order of operations issue, but it was a float issue. This has the inputs of
+//the degree temp taken from the user and the wind speed given from the user and returns the calculated value.
+float getChill(int temp, int speed) {
+ cout << "Calculating windchill..."<< endl;
+ float tempSpeed = pow(speed, .16);
+ float temp1 = 35.74 + (.6215 * temp);
+ float temp2 = 35.75 * tempSpeed;
+ float temp3 = .4275 * temp * tempSpeed;
+ float chill = temp1 - temp2 + temp3;
+ return chill;
+}
+