diff options
Diffstat (limited to 'BlankConsoleLab')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 6 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj.filters | 7 | ||||
| -rw-r--r-- | BlankConsoleLab/CST116-Lab1-Hill-Flowchart.txt | 35 | ||||
| -rw-r--r-- | BlankConsoleLab/CST116-Lab1-Hill.cpp (renamed from BlankConsoleLab/BlankConsoleLab.cpp) | 7 |
4 files changed, 50 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index d2e3ee2..557a49d 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -24,6 +24,7 @@ <ProjectGuid>{3cecade6-3e15-4852-bd24-65bfe5d3a3aa}</ProjectGuid> <RootNamespace>BlankConsoleLab</RootNamespace> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectName>CST116-Lab1-Hill</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> @@ -139,7 +140,10 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="BlankConsoleLab.cpp" /> + <ClCompile Include="CST116-Lab1-Hill.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="CST116-Lab1-Hill-Flowchart.txt" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters index aca1dd9..fa85547 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters @@ -15,8 +15,13 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="BlankConsoleLab.cpp"> + <ClCompile Include="CST116-Lab1-Hill.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> + <ItemGroup> + <Text Include="CST116-Lab1-Hill-Flowchart.txt"> + <Filter>Source Files</Filter> + </Text> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/BlankConsoleLab/CST116-Lab1-Hill-Flowchart.txt b/BlankConsoleLab/CST116-Lab1-Hill-Flowchart.txt new file mode 100644 index 0000000..057e230 --- /dev/null +++ b/BlankConsoleLab/CST116-Lab1-Hill-Flowchart.txt @@ -0,0 +1,35 @@ +FLOATS width, length; + +PRINT "Please enter the width of your kite in centimeters. Use values between 1 - 400 cm."; + +DO { + + SET width; + IF ( width IS LESS THAN 1, OR, width is GREATER THAN 400 ) + PRINT "Please try again with a value between 1 - 400"; + +} WHILE ( width is LESS THAN 1, OR, width is GREATER THAN 400); + +PRINT "Now enter the length, again between 1 - 400cm."; + +DO { + + SET length; + IF ( length IS LESS THAN 1, OR, length is GREATER THAN 400 ) + PRINT "Please try again with a value between 1 - 400"; + +} WHILE ( length is LESS THAN 1, OR, length is GREATER THAN 400); + +PRINT "The dimensions of your kite are " + width + " by " + length + "cm."; + +DOUBLE area = (width * length) / 10000.0 +FLOAT aspectRatio = width / length; + +IF (aspectRatio >= 1){ + PRINT "WARNING: A lower aspect ratio might provide better stability."; +} + +CONSTANT FLOAT mass = 135.0f * area; +DOUBLE forceGravity = 9.8 * mass; + +PRINT "Your kite has a mass of " + mass + " grams." ENDLINE "The kite is experiencing a gravitational force of " + forceGravity + " newtons.";
\ No newline at end of file diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/CST116-Lab1-Hill.cpp index bc4bf7c..0f07f62 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/CST116-Lab1-Hill.cpp @@ -4,8 +4,7 @@ using std::cout; using std::cin; using std::endl; -float width; -float length; +float width, length; int main() @@ -44,8 +43,10 @@ int main() } const float mass = 135.0f * area; + double forceGravity = 9.8 * mass; - cout << endl << "Your kite has a mass of " << mass << " grams."; + cout << endl << "Your kite has a mass of " << mass << " grams." << endl + << "The kite is experiencing a gravitational force of " << forceGravity << " newtons." << endl; } |