summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/CST116-Lab2-Bold.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BlankConsoleLab/CST116-Lab2-Bold.cpp')
-rw-r--r--BlankConsoleLab/CST116-Lab2-Bold.cpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/BlankConsoleLab/CST116-Lab2-Bold.cpp b/BlankConsoleLab/CST116-Lab2-Bold.cpp
new file mode 100644
index 0000000..8abed13
--- /dev/null
+++ b/BlankConsoleLab/CST116-Lab2-Bold.cpp
@@ -0,0 +1,107 @@
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+
+using std::cin;
+using std::cout;
+using std::endl;
+
+float Convertor(float&);
+// CtoF - converts temperature in C to F.
+// @param - Celcius is passed by reference.
+float WindChill(float, float);
+// WindChill - calculates the wind chill temp.
+// @param - Fahrenheit is passing by value.
+// @param - wind speed in mph is passing by value.
+
+int main() {
+
+ char option = 0;
+ float tempF = 0;
+ float tempC = 0;
+ float mph = 0;
+ float CtoF = 0;
+ float Fahr = 0;
+
+ while (option != 'f' && option != 'F' && option != 'c' && option != 'C') {
+ cout << "Please enter F for Fahrenheit or C for Celsius: ";
+ cin >> option;
+ }
+
+ if (option == 'f' || option == 'F')
+ {
+ cout << "\n\nPlease enter your temperature between -80 and 121: ";
+ cin >> tempF;
+
+ while (tempF <= -81 || tempF >= 122) {
+ cout << "Enter your temperature between -80 and 121: ";
+ cin >> tempF;
+ }
+
+ tempC = (tempF - 32) * 1.8;
+ cout << "\nYour entry is " << tempF << " Fahrenheit and it is " << tempC << " in Celsius." << "\n\n";
+
+
+ while (mph <= -1 || mph >= 232)
+ {
+ cout << "Now, enter your wind speed in miles between 0 and 231: ";
+ cin >> mph;
+ }
+ cout << "\nYour wind speed is " << mph << " miles per hour!\n\n";
+
+ }
+
+ else if (option == 'c' || option == 'C')
+ {
+ cout << "\n\nPlease enter your tempareture between -62 and 49.5: ";
+ cin >> tempC;
+
+ while (tempC <= -63 || tempC >= 49.6)
+ {
+ cout << "Enter your temperature between -62 and 49.5: ";
+ cin >> tempC;
+ }
+
+ tempF = tempC * 1.8 + 32;
+
+ cout << "\nYour entry is " << tempC << " and it is " << tempF; cout << " Fahrenheit.\n";
+ while (mph <= 0 || mph >= 231)
+ {
+ cout << "\n\nNow, enter your wind speed in miles between 0 and 231: ";
+ cin >> mph;
+ }
+ cout << "\nYour wind speed is " << mph << " miles per hour!\n\n";
+
+ }
+
+
+ float Convertor(tempC);
+
+ float chill = WindChill(tempF, mph);
+
+ cout << "\tFahrenheit\t" << tempF << "\n";
+ cout << "\tCelsius\t\t" << tempC << "\n";
+ cout << "\tWind Speed\t" << mph << "\n";
+ cout << "\tWind Chill\t" << chill << "\n\n";
+
+
+ return 0;
+}
+
+float Convertor(float& tempC)
+{
+ float Fahr = 0;
+
+ Fahr = tempC * 1.8 + 32;
+
+ return 0.0f;
+}
+
+float WindChill(float tempF, float mph)
+{
+ float chill = 0;
+
+ chill = 35.74 + .6215 * (tempF)-35.75 * pow(mph, 0.16) + 0.4275 * (tempF)*pow(mph, 0.16);
+
+ return chill;
+}