aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacobAKnox <[email protected]>2021-10-27 20:09:10 -0700
committerJacobAKnox <[email protected]>2021-10-27 20:09:10 -0700
commit8ff4d236298feb927b7d838ac9f5d66c849ba502 (patch)
tree49f31c1078cb753255b0d3f36762509e92e95e98
parent9b finished (diff)
downloadcst116-lab5-jacobaknox-8ff4d236298feb927b7d838ac9f5d66c849ba502.tar.xz
cst116-lab5-jacobaknox-8ff4d236298feb927b7d838ac9f5d66c849ba502.zip
9c finished
-rw-r--r--9c/MultipleFiles/MultipleFiles.cpp23
-rw-r--r--9c/MultipleFiles/MultipleFiles.sln31
-rw-r--r--9c/MultipleFiles/MultipleFiles.vcxproj151
-rw-r--r--9c/MultipleFiles/MultipleFiles.vcxproj.filters30
-rw-r--r--9c/MultipleFiles/Output.txt31
-rw-r--r--9c/MultipleFiles/Student.cpp85
-rw-r--r--9c/MultipleFiles/Student.h6
7 files changed, 357 insertions, 0 deletions
diff --git a/9c/MultipleFiles/MultipleFiles.cpp b/9c/MultipleFiles/MultipleFiles.cpp
new file mode 100644
index 0000000..91525dd
--- /dev/null
+++ b/9c/MultipleFiles/MultipleFiles.cpp
@@ -0,0 +1,23 @@
+// 10.6.cpp : This file contains the 'main' function. Program execution begins and ends there.
+// Written by Jacob Knox
+//
+
+#include <iostream>
+#include "Student.h"
+
+using namespace std;
+
+int main()
+{
+ const int NUM_SCORES = 10, NUM_GRADES = 5;
+ float scores[NUM_SCORES] = {};
+ char grades[NUM_SCORES] = {};
+ int counts[NUM_GRADES] = { 0, 0, 0, 0, 0 };
+ float avg = 0;
+
+ GetInputs(scores, NUM_SCORES);
+ GetCounts(scores, grades, counts, NUM_SCORES);
+ avg = CalcAvg(scores, NUM_SCORES);
+ Output(scores, grades, counts, avg, NUM_SCORES, NUM_GRADES);
+
+}
diff --git a/9c/MultipleFiles/MultipleFiles.sln b/9c/MultipleFiles/MultipleFiles.sln
new file mode 100644
index 0000000..1693c72
--- /dev/null
+++ b/9c/MultipleFiles/MultipleFiles.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31729.503
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultipleFiles", "MultipleFiles.vcxproj", "{0A502FCE-1557-47FA-B630-4D0152CD1714}"
+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
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Debug|x64.ActiveCfg = Debug|x64
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Debug|x64.Build.0 = Debug|x64
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Debug|x86.ActiveCfg = Debug|Win32
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Debug|x86.Build.0 = Debug|Win32
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Release|x64.ActiveCfg = Release|x64
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Release|x64.Build.0 = Release|x64
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Release|x86.ActiveCfg = Release|Win32
+ {0A502FCE-1557-47FA-B630-4D0152CD1714}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B56EBA1B-0159-476F-9FA1-693A80EC3A8C}
+ EndGlobalSection
+EndGlobal
diff --git a/9c/MultipleFiles/MultipleFiles.vcxproj b/9c/MultipleFiles/MultipleFiles.vcxproj
new file mode 100644
index 0000000..41a9377
--- /dev/null
+++ b/9c/MultipleFiles/MultipleFiles.vcxproj
@@ -0,0 +1,151 @@
+<?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>{0a502fce-1557-47fa-b630-4d0152cd1714}</ProjectGuid>
+ <RootNamespace>MultipleFiles</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>v142</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</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>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</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" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <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="MultipleFiles.cpp" />
+ <ClCompile Include="Student.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Student.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/9c/MultipleFiles/MultipleFiles.vcxproj.filters b/9c/MultipleFiles/MultipleFiles.vcxproj.filters
new file mode 100644
index 0000000..8a5f8cb
--- /dev/null
+++ b/9c/MultipleFiles/MultipleFiles.vcxproj.filters
@@ -0,0 +1,30 @@
+<?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="MultipleFiles.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Student.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Student.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/9c/MultipleFiles/Output.txt b/9c/MultipleFiles/Output.txt
new file mode 100644
index 0000000..ff79224
--- /dev/null
+++ b/9c/MultipleFiles/Output.txt
@@ -0,0 +1,31 @@
+Output:
+
+Enter score #1 of 10: 99
+Enter score #2 of 10: 45
+Enter score #3 of 10: 69
+Enter score #4 of 10: 87
+Enter score #5 of 10: 76
+Enter score #6 of 10: 52
+Enter score #7 of 10: 10
+Enter score #8 of 10: 80
+Enter score #9 of 10: 34
+Enter score #10 of 10: 26
+The 1 student recived a 99% and got a(n) A.
+The 2 student recived a 45% and got a(n) F.
+The 3 student recived a 69% and got a(n) D.
+The 4 student recived a 87% and got a(n) B.
+The 5 student recived a 76% and got a(n) C.
+The 6 student recived a 52% and got a(n) F.
+The 7 student recived a 10% and got a(n) F.
+The 8 student recived a 80% and got a(n) B.
+The 9 student recived a 34% and got a(n) F.
+The 10 student recived a 26% and got a(n) F.
+The average score is: 57%.
+There were 1A's.
+There were 2B's.
+There were 1C's.
+There were 1D's.
+There were 5F's.
+
+C:\Users\jakno\source\repos\CST116\cst116-lab5-JacobAKnox\9c\MultipleFiles\Debug\MultipleFiles.exe (process 3000) exited with code 0.
+Press any key to close this window . . .
diff --git a/9c/MultipleFiles/Student.cpp b/9c/MultipleFiles/Student.cpp
new file mode 100644
index 0000000..b5f744e
--- /dev/null
+++ b/9c/MultipleFiles/Student.cpp
@@ -0,0 +1,85 @@
+#include <iostream>
+#include "Student.h"
+
+using namespace std;
+
+void GetInputs(float scores[], int size)
+{
+ for (int i = 0; i < size; i++)
+ {
+ cout << "Enter score #" << i + 1 << " of " << size << ": ";
+ cin >> scores[i];
+ }
+}
+
+void GetCounts(float scores[], char grades[], int counts[], int sizeS)
+{
+ for (int i = 0; i < sizeS; i++)
+ {
+ if (scores[i] >= 90)
+ {
+ grades[i] = 'A';
+ counts[0]++;
+ }
+ else if (scores[i] >= 80)
+ {
+ grades[i] = 'B';
+ counts[1]++;
+ }
+ else if (scores[i] >= 70)
+ {
+ grades[i] = 'C';
+ counts[2]++;
+ }
+ else if (scores[i] >= 60)
+ {
+ grades[i] = 'D';
+ counts[3]++;
+ }
+ else
+ {
+ grades[i] = 'F';
+ counts[4]++;
+ }
+ }
+}
+
+int CalcAvg(float scores[], int size)
+{
+ float avg = 0, tot = 0;
+
+ for (int i = 0; i < size; i++)
+ {
+ tot += scores[i];
+ }
+
+ avg = tot / size;
+
+ return avg;
+}
+
+void Output(float scores[], char grades[], int counts[], int avg, int sizeS, int sizeC)
+{
+ for (int i = 0; i < sizeS; i++)
+ {
+ cout << "The " << i + 1 << " student recived a " << scores[i] << "% and got a(n) " << grades[i] << ".\n";
+ }
+
+ cout << "The average score is: " << avg << "%.\n";
+
+ char letter;
+ for (int i = 0; i < sizeC; i++)
+ {
+
+ if (i != 4)
+ {
+ letter = 65 + i;
+ }
+ else
+ {
+ letter = 70;
+ }
+
+ cout << "There were " << counts[i] << letter << "'s.\n";
+ }
+}
diff --git a/9c/MultipleFiles/Student.h b/9c/MultipleFiles/Student.h
new file mode 100644
index 0000000..5b0f613
--- /dev/null
+++ b/9c/MultipleFiles/Student.h
@@ -0,0 +1,6 @@
+#pragma once
+
+void GetInputs(float[], int);
+void GetCounts(float[], char[], int[], int);
+int CalcAvg(float[], int);
+void Output(float[], char[], int[], int, int, int); \ No newline at end of file