From 18eff814e56204cb90cb4b90fb898aaa9cf39c71 Mon Sep 17 00:00:00 2001 From: Bold Demchig Date: Wed, 9 Nov 2022 22:23:45 -0800 Subject: Complete --- BlankConsoleLab/BlankConsoleLab.cpp | 16 ---- BlankConsoleLab/BlankConsoleLab.vcxproj | 10 +-- BlankConsoleLab/BlankConsoleLab.vcxproj.filters | 2 +- BlankConsoleLab/CST116-Lab2-Bold.cpp | 107 ++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 22 deletions(-) delete mode 100644 BlankConsoleLab/BlankConsoleLab.cpp create mode 100644 BlankConsoleLab/CST116-Lab2-Bold.cpp diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp deleted file mode 100644 index ed5f807..0000000 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - -#include - -using namespace std; - -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - cout << "Hello World!\n"; -} - diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index db2e734..158b739 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -29,26 +29,26 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode @@ -139,7 +139,7 @@ - + diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters index aca1dd9..75010ea 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters @@ -15,7 +15,7 @@ - + Source Files 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 +#include +#include + +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; +} -- cgit v1.2.3