summaryrefslogtreecommitdiff
path: root/BlankConsoleLab
diff options
context:
space:
mode:
authorjacobdw22 <[email protected]>2022-11-02 01:50:13 -0700
committerjacobdw22 <[email protected]>2022-11-02 01:50:13 -0700
commit3e5338e846d5621c9a49f6810eef3d2a4d82a4a7 (patch)
tree9bfbdbdb5a555a6831470788af38c712f1cd6044 /BlankConsoleLab
parentNow rejects values over or under the limits, and asks for a response again. (diff)
downloadcst116-lab2-jacobdw22-3e5338e846d5621c9a49f6810eef3d2a4d82a4a7.tar.xz
cst116-lab2-jacobdw22-3e5338e846d5621c9a49f6810eef3d2a4d82a4a7.zip
Simple changes
Diffstat (limited to 'BlankConsoleLab')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 2252640..f6e2ee4 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -21,9 +21,6 @@ const float CMAX = 49.5;
const float CMIN = -62; //Set values for minimum and maximum temperatures.
-
-
-
float CtoF(float Fahrenheit, float Celsius) {
Fahrenheit = (Celsius * 9.0 / 5.0) + 32.0; //Converts Celsius to Fahrenheit
@@ -32,12 +29,15 @@ float CtoF(float Fahrenheit, float Celsius) {
}
+
+
+
int main()
{
float Celsius = 0.0; //Defines Celsius for the conversion function
float Fahrenheit = 0.0; //Defines Fahrenheit for the conversion function
- Loop:
+ Loop: //Placeholder to loop back to
cout << "Please enter a temperature between -62 and 49.5 degrees Celsius: \n";
cin >> Celsius; //Reads in Celsius from the user input
@@ -46,7 +46,7 @@ int main()
cout << Celsius << " Degrees Celsius is approximately " << CtoF(Fahrenheit, Celsius) << " Degrees Fahrenheit\n\n";
}
else {
- goto Loop;
+ goto Loop; //Goes back to placeholder to Loop in case of invalid response (past limits)
}
}