diff options
| author | alexandra-apetroaei <andra@MSI> | 2022-10-29 09:29:53 -0800 |
|---|---|---|
| committer | alexandra-apetroaei <andra@MSI> | 2022-10-29 09:29:53 -0800 |
| commit | e4de75de60743cc35e8d306b4801f3069f211467 (patch) | |
| tree | a62de8b38ecfabb86731340b8e1b0ac9ca03fdc7 | |
| parent | Setting up GitHub Classroom Feedback (diff) | |
| download | cst116-lab2-alexandra-apetroaei-e4de75de60743cc35e8d306b4801f3069f211467.tar.xz cst116-lab2-alexandra-apetroaei-e4de75de60743cc35e8d306b4801f3069f211467.zip | |
first step
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 43 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 8 | ||||
| -rw-r--r-- | BlankConsoleLab/Project2-Apetroaei.cpp | 49 |
3 files changed, 91 insertions, 9 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..928b2cc 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -1,16 +1,49 @@ -// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. -// +// Lab 2 Alexandra Apetroaei (CST 116) #include <iostream> +#include <iomanip> +#include <cmath> using namespace std; - using std::cout; using std::cin; +using std::string; using std::endl; +float fahr; +float cel; +float mph; + +char input; +char menu; + int main() { - cout << "Hello World!\n"; -} + //ask user to choose temperature calculations + cout << "Do you want to enter temperature in Farenheit? or Celcius?" << endl; + cout << "Options: Farenheit (f) Celcius (c)." << endl; + + //converter to use + cin >> input; + + //if user types f, using farenheit + if (input == 'f') + { + // ask user to input temperature + cout << "Please enter temperature in Farenheit:" << endl; + cin >> fahr; + + //Display result of calculation + } + //if user types c, using celcius + else if (input == 'c') + { + cout << "Please enter temperature in Celcius:" << endl; + cin >> cel; + + fahr = ((cel * 9.0 / 5.0) + 32.0); + + } + return 0; +}
\ 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> diff --git a/BlankConsoleLab/Project2-Apetroaei.cpp b/BlankConsoleLab/Project2-Apetroaei.cpp new file mode 100644 index 0000000..ef526e3 --- /dev/null +++ b/BlankConsoleLab/Project2-Apetroaei.cpp @@ -0,0 +1,49 @@ +// Lab 2 Alexandra Apetroaei (CST 116) + +#include <iostream> +#include <iomanip> +#include <cmath> + +using namespace std; +using std::cout; +using std::cin; +using std::string; +using std::endl; + +int float fahr; +int float cel; +int float mph; + +char input; +char menu; + +int main() +{ + //ask user to choose temperature calculations + cout << "Do you want to enter temperature in Farenheit? or Celcius?" << endl; + cout << "Options: Farenheit (f) Celcius (c)." << endl; + + //converter to use + cin >> input; + + //if user types f, using farenheit + if (input == 'f') + { + // ask user to input temperature + cout << "Please enter temperature in Farenheit:" << endl; + cin >> fahr; + + //Display result of calculation + } + //if user types c, using celcius + else if (input == 'c') + { + cout << "Please enter temperature in Celcius:" << endl; + cin >> cel; + + fahr = ((cel * 9.0 / 5.0) + 32.0); + + } + + return 0; +}
\ No newline at end of file |