summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonCr <[email protected]>2022-11-12 00:13:03 -0800
committerJonCr <[email protected]>2022-11-12 00:13:03 -0800
commit875dfeb5d3703a33a6f0260eb0c8af4306af3b51 (patch)
treec6ec09ca90147daab9cb3317d34984eeba416b0a
parentUpdate (diff)
downloadcst116-lab2-cognitiveshadow-master.tar.xz
cst116-lab2-cognitiveshadow-master.zip
FinishedHEADmaster
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp12
-rw-r--r--CST116-Lab2-Crombie-pseudocode.txt60
2 files changed, 65 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index dc9df83..a806d9b 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -104,15 +104,13 @@ float getWindSpeed()
{
float windSpeed = -100;
+ while (windSpeed < 0 || windSpeed > 231)
{
- while (windSpeed < 0 || windSpeed > 231)
- {
- cout << endl << "Enter wind speed in MPH: ";
- cin >> windSpeed;
+ cout << endl << "Enter wind speed in MPH: ";
+ cin >> windSpeed;
- if (windSpeed < 0 || windSpeed > 231)
- cout << endl << "Please enter between " << 0 << " and " << 231 << "." << endl;
- }
+ if (windSpeed < 0 || windSpeed > 231)
+ cout << endl << "Please enter between 0 and 231." << endl;
}
return windSpeed;
diff --git a/CST116-Lab2-Crombie-pseudocode.txt b/CST116-Lab2-Crombie-pseudocode.txt
new file mode 100644
index 0000000..3a5f4ef
--- /dev/null
+++ b/CST116-Lab2-Crombie-pseudocode.txt
@@ -0,0 +1,60 @@
+Declare temp
+Set select equal to 0
+Set windSpeed equal to 0
+Run function selectType
+ Set choose equal to '0'
+ While select does not equal 1 and select does not equal 2
+ Print "Enter temperature in Fahrenheit or Celsius?"
+ [1] Fahrenheit
+ [2] Celsius
+ Selection: "
+ Input choose
+ If choose is equal to '1'
+ Set select equal to 1
+ Else if choose is equal to '2'
+ Set select equal to 2
+ Else print "Please enter only 1 or 2."
+ Return select
+Set select equal to return of function selectType
+Run function getTemp, inputting select
+ Set temp equal to -100
+ Set constant minC equal to -62
+ Set constant maxC equal to 49.5
+ Set constant minF equal to -80
+ Set constant maxF equal to 121
+ If select is equal to 1
+ While temp is less than minF or temp is greater than maxF
+ Print "Enter temperature: "
+ Input temp
+ If temp is less than minF or temp is greater than maxF
+ Print "Please enter between " minF " and " maxF "."
+ If select is equal to 2
+ While temp is less than minC or temp is greater than maxC
+ Print "Enter temperature: "
+ Input temp
+ If temp is less than minC or temp is greater than maxC
+ Print "Please enter between " minC " and " maxC "."
+ Return temp
+Set temp equal to return of function getTemp
+If select is equal to 2
+ Run function calcTemp, inputting temp
+ Give temp alias Celsius
+ Set Fahrenheit equal to 0
+ Set Fahrenheit equal to 32 + ((9 * Celsius) / 5)
+ Return Fahrenheit
+ Set temp equal to return of function calcTemp
+Run function getWindSpeed
+ Set windSpeed equal to -100
+ While windSpeed is less than 0 or windSpeed is greater than 231
+ Print "Enter wind speed in MPH: "
+ Input windSpeed
+ If windSpeed is less than 0 or windSpeed is greater than 231
+ Print "Please enter between 0 and 231."
+ Return windSpeed
+Set windSpeed equal to return of function getWindSpeed
+Run function calcWindChill, inputting temp and windSpeed
+ Set windChill equal to 0
+ Set windChill equal to 35.74 + 0.6215 * temp - 35.75 * windSpeed ^ 0.16 + 0.4275 * temp * windSpeed ^ 0.16
+ Print "For temperatures of " temp " degrees Fahrenheit and wind speeds of " windSpeed " MPH, the windchill is " windChill
+Return 0
+