summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorDoolyBoi <[email protected]>2022-11-09 21:15:03 -0800
committerDoolyBoi <[email protected]>2022-11-09 21:15:03 -0800
commite8706080eda235515472e4494d6cf75535d6c5ba (patch)
tree2288402d79215f91d923e1dbaafa2406a5941e22 /BlankConsoleLab/BlankConsoleLab.cpp
parentadded a space (diff)
downloadcst116-lab2-abd00l4h-e8706080eda235515472e4494d6cf75535d6c5ba.tar.xz
cst116-lab2-abd00l4h-e8706080eda235515472e4494d6cf75535d6c5ba.zip
renamed project
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp99
1 files changed, 0 insertions, 99 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
deleted file mode 100644
index 6a43967..0000000
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
-
-#include <iostream>
-
-using namespace std;
-
-float C_to_F(float x);
-void getUserInputs(float& value, float min, float max, string type);
-float calculate(float mph, float degrees);
-
-//m is min; M is max
-//Fahrenheit Constants
-const float Fm = -80;
-const float FM = 121;
-//Celcius Constants
-const float Cm = -62;
-const float CM = 49.5;
-//Wind Speed Constants
-const float Wm = 0;
-const float WM = 231;
-
-/*
-Function: C_to_F
-Input: Celcius(float)
-Return: Fahrenheit(float)
-Purpose: Converts celius to fahrenheit
-*/
-float C_to_F(float x)
-{
- x *= 1.8;
- x += 32;
- return x;
-}
-
-/*
-Function: GetUserInputs
-Input: variable(float), min value(float) max value(float), variable's type(string)
-Return: None
-Purpose: Ask user for the value of type between min and max
-*/
-void getUserInputs(float& value, float min, float max, string type)
-{
- while (value <= min || value >= max)
- {
- cout << "What is the value of " << type << "?" << endl;
- cout << "(Enter a value between " << min << " & " << max << ")" << endl;
- cin >> value;
- }
-}
-
-/*
-Function: calculate
-Input: MPH(float), degrees F(float)
-Return: Wind Chill(float)
-Purpose: To calculate wind chill from wind speed and temperature
-*/
-float calculate(float mph, float degrees)
-{
- return (35.74 + (0.6215 * degrees) - (35.75 * pow(mph, 0.16)) + (0.4275 * degrees * pow(mph, 0.16)));
-}
-
-/*
-Function: main()
-Input:None
-Return:None
-Purpose: Ask user what degree they will enter temp in and run functions based off that
-*/
-int main()
-{
- string CorF;
- float temp;
- float wSpeed;
- float windChill;
-
- while (CorF != "C" && CorF != "F")
- {
- cout << "Do you want to enter in Fahrenheit (F) or Celsius (C)" << endl;
- cin >> CorF;
- }
-
- if (CorF == "F")
- {
- getUserInputs(temp, Fm, FM, "Fahrenheit");
- }
- else
- {
- getUserInputs(temp, Cm, CM, "Celcius");
- temp = C_to_F(temp);
- cout << "That is " << temp << " degrees in Fahrenheit" << endl;
- }
-
- getUserInputs(wSpeed, Wm, WM, "Wind Speed");
-
- windChill = calculate(wSpeed, temp);
-
- cout << "At " << temp << " degrees Fahrenheit and at a wind speed of " << wSpeed << "MPH, the windchill is " << windChill << ".";
-}
-