diff options
| author | Lloyd Crawford <Lloyd Crawford@LAPTOP-7HJCDLE5> | 2022-11-09 16:38:01 -0800 |
|---|---|---|
| committer | Lloyd Crawford <Lloyd Crawford@LAPTOP-7HJCDLE5> | 2022-11-09 16:38:01 -0800 |
| commit | 97f55faef5d4e7a6844de89216077dce8c12ca3c (patch) | |
| tree | f8d7dd3dc7bea8faff9fb41c1483533c9d614bef /CST116-Ch11-Debugging | |
| parent | Initial commit (diff) | |
| download | cst116-ch11-debugging-19-ruin-97f55faef5d4e7a6844de89216077dce8c12ca3c.tar.xz cst116-ch11-debugging-19-ruin-97f55faef5d4e7a6844de89216077dce8c12ca3c.zip | |
Diffstat (limited to 'CST116-Ch11-Debugging')
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging-Crawford.cpp (renamed from CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp) | 23 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj | 6 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters | 5 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj | 136 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj2 | 139 |
5 files changed, 299 insertions, 10 deletions
diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Crawford.cpp index 53830da..623683f 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Crawford.cpp @@ -1,6 +1,7 @@ /******************************************************************** * File: Chapter 11 Debug.cpp -* +* Lloyd Crawford, CST 116 02, Chapter 11 Debug, Github + * General Instructions: Complete each step before proceeding to the * next. * @@ -18,13 +19,13 @@ * 4) Build and execute the program. * 5) Update the file paths below to correctly represent the path you * created. -* 6) Rebuild and execute the program. +* 6) Rebuild and execute the program. Wont run program as path is not established. * 7) Examine the code and the output and notice the use of * parallel arrays. * 8) Add the output file created via the execution of * your program to your Project. Execute your program again * and notice how Visual Studio has rewritten your output file -* and asks if you would like to reload the file (select Yes). +* and asks if you would like to reload the file (select Yes). * 9) Examine the contents of both the input and the output file. * 10) Fix all the problems in your code that exist in relation to * the output. Verify that your output is appropriate for your @@ -53,7 +54,7 @@ * ********************************************************************/ #include <iostream> -#include <fstream> // For the files!!!! +#include <fstream> // For the files!!!! // lol stream......good thing its not a pstream ^o^ . #include <iomanip> // For manipulators & formatting options using std::cin; using std::cout; @@ -81,10 +82,10 @@ int main() ifstream inFile; // Notice how this automatically opens the file - ofstream outFile("C:\\TEMP\\Chap_11_Report.txt"); - - inFile.open("C:\\TEMP\\Chap_11_data.txt"); + ofstream outFile("C:\\Users\\Lloyd Crawford\\source\\repos\\cst116-ch11-debugging-19-Ruin\\CH_11_Report.txt"); + inFile.open("C:\\Users\\Lloyd Crawford\\source\\repos\\cst116-ch11-debugging-19-Ruin\\CH_11_Data_LC.txt"); + // double slash has to be used in all file in or out. If you use a single slach bad things happen. if (inFile.is_open()) { record_counter = ReadData(inFile, outFile, name, age); @@ -122,13 +123,19 @@ int ReadData(ifstream& inFile, ofstream& outFile, char name[][MAX], int age[]) counter++; inFile >> name[counter] >> age[counter]; } + // next segment is for reading and priming the file. + cout << setiosflags(ios::left) << setw(25) + << name[counter] << resetiosflags(ios::left) + << setw(4) << age[counter] << endl; + counter++; + inFile >> name[counter] >> age[counter]; return counter; } void WriteOutputFile(ofstream& outFile, char name[][MAX], int age[], int counter) { outFile << " Here is the Output File" << endl; - for (int r = 0; r <= counter; r++) + for (int r = 0; r < counter; r++) // femove the = here to stop the report from adding wierd coding to your solution and your file. nasty bug. { outFile << setiosflags(ios::left) << setw(25) << name[r] << setw(4) diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj index 2073e5b..1c5380a 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj @@ -24,6 +24,7 @@ <ProjectGuid>{2f33289e-7d00-4ec4-9951-f3db9cd7c178}</ProjectGuid> <RootNamespace>CST116Ch11Debugging</RootNamespace> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectName>CST116-Ch11-Debugging-Crawford</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> @@ -127,7 +128,10 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="CST116-Ch11-Debugging.cpp" /> + <ClCompile Include="CST116-Ch11-Debugging-Crawford.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="..\CH_11_Data_LC.txt" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters index 2029dc7..42b6d8a 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters @@ -15,8 +15,11 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="CST116-Ch11-Debugging.cpp"> + <ClCompile Include="CST116-Ch11-Debugging-Crawford.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> + <ItemGroup> + <Text Include="..\CH_11_Data_LC.txt" /> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj b/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj new file mode 100644 index 0000000..b00994d --- /dev/null +++ b/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj @@ -0,0 +1,136 @@ +<?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>{2f33289e-7d00-4ec4-9951-f3db9cd7c178}</ProjectGuid> + <RootNamespace>CST116Ch11Debugging</RootNamespace> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectName>CST116-Ch11-Debugging-Crawford</ProjectName> + </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-Ch11-Debugging-Crawford.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj2 b/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj2 new file mode 100644 index 0000000..c502ba8 --- /dev/null +++ b/CST116-Ch11-Debugging/~AutoRecover.CST116-Ch11-Debugging.vcxproj2 @@ -0,0 +1,139 @@ +<?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>{2f33289e-7d00-4ec4-9951-f3db9cd7c178}</ProjectGuid> + <RootNamespace>CST116Ch11Debugging</RootNamespace> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectName>CST116-Ch11-Debugging-Crawford</ProjectName> + </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-Ch11-Debugging-Crawford.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="..\CH_11_Data_LC.txt" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file |