diff options
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 24 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 8 | ||||
| -rw-r--r-- | enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp | 58 |
3 files changed, 83 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> diff --git a/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp b/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp new file mode 100644 index 0000000..fd323c3 --- /dev/null +++ b/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp @@ -0,0 +1,58 @@ +/* +* BlankConsoleLab.cpp : This file contains the 'main' function.Program execution begins and ends there. +* +* Morgan Cyrus +* CST116_Lab1_Cyrus +* Kite Lab +* +* Note: This has been put in order of completion. Do one step and then compile / check it. +* +* Ask the user for the width and length in centimeters. +* Print what the user entered for the width and length. +* Compute the area of the kite. Area = (width × length)/ 2 +* Convert the square centimeters to square meters by dividing by 10000. +* Print area in square meters. Note: square meters will use decimals. +* Compute the aspect ratio of the kite. The aspect ratio is width / length +* If the aspect ratio is greater than or equal to 1, print a warning message that a lower aspect ratio would provide more stability. +* +* Your output should be self-documenting. In other words, it should show the input with labels and then the output. You can see some examples of final outputs at the end. +*/ + +#include <iostream> + +using std::cout; +using std::cin; +using std::endl; + +int kiteCalc(int wid, int len); + +int main() +{ + int userIn = 0; + int kiteWidth = 0; + int 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(int wid, int len) +{ + //calculate kite area in cm^2 + float kiteAreaCalc = (wid * len)/2; + + //convert cm^2 to meters^2 + kiteAreaCalc = kiteAreaCalc / 1000; + + return kiteAreaCalc; +} |