summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortafaar <[email protected]>2022-11-09 17:36:14 -0800
committertafaar <[email protected]>2022-11-09 17:36:14 -0800
commit24426872ccc243c6d652ee43ada853b63690d1e1 (patch)
tree72ed8fc283cfb9a8a15e82f3b53262262bb67d50
parentadded choice to continue (diff)
downloadcst116-lab2-hill-24426872ccc243c6d652ee43ada853b63690d1e1.tar.xz
cst116-lab2-hill-24426872ccc243c6d652ee43ada853b63690d1e1.zip
fixed while loop for main functionHEADmaster
-rw-r--r--BlankConsoleLab/CST116 -Lab2-Hill.cpp4
-rw-r--r--BlankConsoleLab/CST116-Lab2-Flowchart.txt12
2 files changed, 13 insertions, 3 deletions
diff --git a/BlankConsoleLab/CST116 -Lab2-Hill.cpp b/BlankConsoleLab/CST116 -Lab2-Hill.cpp
index 81d82ec..6e96b6d 100644
--- a/BlankConsoleLab/CST116 -Lab2-Hill.cpp
+++ b/BlankConsoleLab/CST116 -Lab2-Hill.cpp
@@ -69,9 +69,9 @@ float GetWindChill() {
int main()
{
- char choice = 'n';
+ char choice = 'Y';
- while (choice != 'Y') {
+ while (choice == 'Y') {
cout << "Please enter a temperature between -80 to 121 degrees fahrenheit, or -62 and 49.5 degrees celsius." << endl;
cout << "Example entries: -32.3 F, 27.8 C\n" << endl;
diff --git a/BlankConsoleLab/CST116-Lab2-Flowchart.txt b/BlankConsoleLab/CST116-Lab2-Flowchart.txt
index 58171d1..169fbf3 100644
--- a/BlankConsoleLab/CST116-Lab2-Flowchart.txt
+++ b/BlankConsoleLab/CST116-Lab2-Flowchart.txt
@@ -65,6 +65,11 @@ DEFINE FUNCTION THAT RETURNS A FLOAT VALUE GetWindChill(){
MAIN PROGRAM(){
+ INITIALIZE CHAR choice TO BE 'Y'
+
+ WHILE choice IS Y, DO THIS {
+
+
PRINT "Please enter a temperature between -80 to 121 degrees fahrenheit, or -62 and 49.5 degrees celsius.";
PRINT "Example entries: -32.3 F, 27.8 C";
@@ -124,9 +129,14 @@ MAIN PROGRAM(){
SET windChillCelsius TO RETURN VALUE FROM ConvertTemperature WITH PARAMETERS windChillFahrenheit AND 'F';
PRINT "Conversions for [TEMPERATURE INPUTTED BY USER] with wind speed [WIND SPEED ENTERED BY USER]MPH.";
-
PRINT [FORMATTED TABLE WITH HEADERS FOR TEMPERATURE IN CELSIUS AND FAHRENHEIT, WIND SPEED, AND CALCULATED WIND CHILL];
+ PRINT "If you would like to input another set of data, please enter 'Y'";
+
+ SET choice TO INPUT;
+
+ }
+
END PROGRAM;
} \ No newline at end of file