summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorjacobdw22 <[email protected]>2022-11-02 01:49:04 -0700
committerjacobdw22 <[email protected]>2022-11-02 01:49:04 -0700
commit6dd000d0c1a5346eed741dca356ea7507e5567bf (patch)
tree3acee1269a5687286a6fb4012be90c3c157e03a4 /BlankConsoleLab/BlankConsoleLab.cpp
parentMade a Celsius to Fahrenheit converter. (diff)
downloadcst116-lab2-jacobdw22-6dd000d0c1a5346eed741dca356ea7507e5567bf.tar.xz
cst116-lab2-jacobdw22-6dd000d0c1a5346eed741dca356ea7507e5567bf.zip
Now rejects values over or under the limits, and asks for a response again.
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 4b305ff..2252640 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -37,17 +37,17 @@ int main()
float Celsius = 0.0; //Defines Celsius for the conversion function
float Fahrenheit = 0.0; //Defines Fahrenheit for the conversion function
+ Loop:
- if (Celsius <= 49.5 && Celsius >= -62) {
- cout << "Please enter a temperature between -62 and 49.5 degrees Celsius: \n";
- cin >> Celsius; //Reads in Celsius from the user input
+ cout << "Please enter a temperature between -62 and 49.5 degrees Celsius: \n";
+ cin >> Celsius; //Reads in Celsius from the user input
+
+ if (Celsius <= CMAX && Celsius >= CMIN) {
+ cout << Celsius << " Degrees Celsius is approximately " << CtoF(Fahrenheit, Celsius) << " Degrees Fahrenheit\n\n";
}
- else{
- cout << "Please enter a temperature between -62 and 49.5 degrees Celsius: \n";
+ else {
+ goto Loop;
}
-
- cout << Celsius << " Degrees Celsius is approximately " << CtoF(Fahrenheit, Celsius) << " Degrees Fahrenheit\n\n";
-
}