diff options
| author | Morgan Cyrus <[email protected]> | 2022-10-17 22:41:05 -0700 |
|---|---|---|
| committer | Morgan Cyrus <[email protected]> | 2022-10-17 22:41:05 -0700 |
| commit | 9604bbb7aa0487c319076a4464dcafcf98483fbb (patch) | |
| tree | 20fabb31769105009c50ced01e2c1dc8e968dbec /BlankConsoleLab | |
| parent | kiteCalc() (diff) | |
| download | archived-cst116-lab1-cyrus-9604bbb7aa0487c319076a4464dcafcf98483fbb.tar.xz archived-cst116-lab1-cyrus-9604bbb7aa0487c319076a4464dcafcf98483fbb.zip | |
float
Diffstat (limited to 'BlankConsoleLab')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 24 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 8 |
2 files changed, 25 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ba46e62..ce23632 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -24,16 +24,34 @@ using std::cout; using std::cin; using std::endl; +float kiteCalc(int wid, int len); + int main() { - int userIn = 0; - int kiteWidth = 0; - int kiteLen = 0; + float kiteWidth = 0; + float kiteLen = 0; + float kiteArea = 0; cout << "Enter value for kite width in cm: "; cin >> kiteWidth; cout << endl << "Enter value for kite length in cm: "; cin >> kiteLen; + cout << "You have entered " << kiteWidth << "cm for kite width, and " << kiteLen << "cm for kite length." << endl; + + kiteArea = kiteCalc(kiteWidth, kiteLen); + cout << "The area of the kite, in square meters, is: " << kiteArea << endl; + + +} + +int kiteCalc(float wid, float len) +{ + //calculate kite area in cm^2 + float kiteAreaCalc = (wid * len)/2; + + //convert cm^2 to meters^2 + kiteAreaCalc = kiteAreaCalc / 1000; + return kiteAreaCalc; } 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> |