diff options
| author | Musa Ahmed <[email protected]> | 2022-10-12 11:45:20 -0700 |
|---|---|---|
| committer | Musa Ahmed <[email protected]> | 2022-10-12 11:45:20 -0700 |
| commit | 30f694af6449574b630b1a5b36aa4d0896ddad55 (patch) | |
| tree | 6f7ecd26896e442f28137201fd2be17e5e845f16 /CST116-Ch7-Debugging | |
| parent | Answered questions & added text file (diff) | |
| download | cst116-ch7-debugging-m005a-30f694af6449574b630b1a5b36aa4d0896ddad55.tar.xz cst116-ch7-debugging-m005a-30f694af6449574b630b1a5b36aa4d0896ddad55.zip | |
Renamed & Added Flowchart
Diffstat (limited to 'CST116-Ch7-Debugging')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.cpp | 83 | ||||
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.txt | 24 | ||||
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.sln | 31 | ||||
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj | 138 | ||||
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.filters | 27 | ||||
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.user | 4 |
6 files changed, 0 insertions, 307 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.cpp deleted file mode 100644 index 9563dba..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************** -* File: CST116-Ch7-Debugging.cpp -* -* General Instructions: Complete each step before proceeding to the -* next. -* -* Debugging Exercise 1 -* -* 1) Insert a breakpoint on the lines indicated in the code. -* 2) Run to Breakpoint 1. -* 3) When prompted, enter your age. -* 4) When the execution stops, add a watch on age and verify that -* the value in age is what you typed in. -* 5) Step over the if statement. -* 6) Why did the value in age change? -* In the if statement, the conditional was written as "age = 0" -* instead of "age == 1", thus the age is set to 1 everytime. -* 7) Fix the problem and repeat Steps 2 � 5 to verify the -* problem was corrected. -* 8) Stop debugging. -* -* Debugging Exercise 2 -* -* 1) Run to Breakpoint 1. -* 2) When prompted, enter the value 25 for your age. -* 3) Step over the if statement. Execution of the program should -* continue on the else if statement. -* 4) Verify that 25 is still stored in age. -* 5) Step over the else if. -* 6) Why is the program going to print "Teenager" for an age of 25? -* The else if statement was checking if the age was greater than -* or equal to 12 OR less than or equal to 19. Instead it should be -* checking if the age is between 12 AND 19 inclusively. -* 7) Fix the problem and repeat Steps 1 � 5 to verify the -* problem was corrected. -* 8) Stop debugging. -* 9) Remove Breakpoint1. -* -* Debugging Exercise 3 -* -* 1) Run the program without debugging. -* 2) When prompted, enter the value of 10 for your age. -* 3) Why does the program print both "Child" and "Adult"? -* There is a cout statement at the end of all the else if statements -* which is executing every time main is run. -* 4) Re-run the program this time with debugging and run to -* Breakpoint 2. -* 5) Why is the action with the else executing? -* The else statement has a semicolon at the end of it, so the statement -* is not included in the else statement and runs regardless of any conditions. -* Everytime main is executed, it will print adult at the end. -* 6) Fix the problem and re-run to verify the problem was corrected. -********************************************************************/ - -#include <iostream> -using std::cout; -using std::endl; -using std::cin; - -int main() -{ - int age = 0; - - cout << "Enter your age: "; - cin >> age; - - // Breakpoint 1 - // Put a breakpoint on the following line - if (age == 1) - cout << "First Birthday" << endl; - else if (age >= 12 && age <= 19) - cout << "Teenager" << endl; - else if (age < 12) - cout << "Child" << endl; - else if (age > 62) - cout << "Senior" << endl; - // Breakpoint 2 - // Put a breakpoint on the following line - else { - cout << "Adult" << endl; - } - return 0; -}
\ No newline at end of file diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.txt b/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.txt deleted file mode 100644 index 94266c1..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging-Ahmed.txt +++ /dev/null @@ -1,24 +0,0 @@ -FOR CHILD : - - Enter your age: 10 -Child - -C:\Users\macho\Source\Repos\cst116-ch7-debugging-M005A\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 18964) exited with code 0. - -FOR TEENAGER : -Enter your age: 15 -Teenager - -C:\Users\macho\Source\Repos\cst116-ch7-debugging-M005A\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 18828) exited with code 0. - -FOR ADULT : -Enter your age: 55 -Adult - -C:\Users\macho\Source\Repos\cst116-ch7-debugging-M005A\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 14928) exited with code 0. - -FOR SENIOR : -Enter your age: 65 -Senior - -C:\Users\macho\Source\Repos\cst116-ch7-debugging-M005A\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 5912) exited with code 0.
\ No newline at end of file diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.sln b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.sln deleted file mode 100644 index fef98b1..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.sln +++ /dev/null @@ -1,31 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.3.32804.467
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116-Ch7-Debugging", "CST116-Ch7-Debugging.vcxproj", "{B0D44148-EC98-40C2-9B22-161D71C6254B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Debug|x64.ActiveCfg = Debug|x64
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Debug|x64.Build.0 = Debug|x64
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Debug|x86.ActiveCfg = Debug|Win32
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Debug|x86.Build.0 = Debug|Win32
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Release|x64.ActiveCfg = Release|x64
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Release|x64.Build.0 = Release|x64
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Release|x86.ActiveCfg = Release|Win32
- {B0D44148-EC98-40C2-9B22-161D71C6254B}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {B1BAFB67-0814-461E-B8A6-F98D952B9DA1}
- EndGlobalSection
-EndGlobal
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj deleted file mode 100644 index f9cc4e8..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
- <ProjectGuid>{b0d44148-ec98-40c2-9b22-161d71c6254b}</ProjectGuid>
- <RootNamespace>CST116Ch7Debugging</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <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>v143</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="CST116-Ch7-Debugging-Ahmed.cpp" />
- </ItemGroup>
- <ItemGroup>
- <Text Include="CST116-Ch7-Debugging-Ahmed.txt" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.filters b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.filters deleted file mode 100644 index 6d3c958..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="CST116-Ch7-Debugging-Ahmed.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <Text Include="CST116-Ch7-Debugging-Ahmed.txt">
- <Filter>Source Files</Filter>
- </Text>
- </ItemGroup>
-</Project>
\ No newline at end of file diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.user b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.user deleted file mode 100644 index 0f14913..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup />
-</Project>
\ No newline at end of file |