diff options
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 77 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 8 |
2 files changed, 76 insertions, 9 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..9a870a3 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -1,6 +1,3 @@ -// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - #include <iostream> using namespace std; @@ -8,9 +5,79 @@ using namespace std; using std::cout; using std::cin; using std::endl; +using std::string; +char y; +char n; -int main() +int fahrenheit(int t); +int windchill(); + + +int fahrenheit(int t) { - cout << "Hello World!\n"; + int f{}; + + //f = (t * (9 / 5)) + 32; + f = (9 / 5) * t + 32; + + return f; } +int main() +{ + float t{}; + float f{}; + float w{}; + float wc{}; + char choice{}; + + //collects a temp + cout << "Enter a temperature between -80 and 121: "; + cin >> t; + + //makes sure temp is between -80 and 121 + while (t < -80 || t > 121) + { + cout << "Input invalid, please enter a number between -80 and 121" << endl; + cin.ignore(99, '\n'); + return t; + } + + cout << f << endl; + + + + + cout << "type y or n" << " is the tempterature in fahrenheit?"; + // cin >> choice; + if (choice == 'n') + { + f = fahrenheit(t); + } + if (choice == 'y') + { + cout << "no change"; + } + + //collects windspeed + cout << "Enter a wind speed between 0 and 231: "; + cin >> w; + //windspeed between 0-231 + while (w < 0 || w > 231) + { + cout << "Input invalid, please enter a number between 0 and 231" << endl; + cin.ignore(99, '\n'); + return w; + } + + //f = temp w = wind + wc = (35.74 + 0.6215 * f - 35.75 * pow(w, 0.16) + .4275 * f * pow(w, 0.16)); + + return wc; + + //displays wind, temp, and windchill + cout << w << endl; + cout << f << endl; + cout << wc << endl; + +}
\ No newline at end of file diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index db2e734..d2e3ee2 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -29,26 +29,26 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v142</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v142</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v142</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v142</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> |