aboutsummaryrefslogtreecommitdiff
path: root/Homework6ReeceWarner
diff options
context:
space:
mode:
authorrPatrickWarner <[email protected]>2024-02-13 19:16:52 -0800
committerrPatrickWarner <[email protected]>2024-02-13 19:16:52 -0800
commitac302b109eefa96a332d1273754c3967f12db5d6 (patch)
tree7bc38a6b73ce67b1335f313cc76c79459a4bb4b5 /Homework6ReeceWarner
parentadd deadline (diff)
downloadhomework-6-reecepwarner-ac302b109eefa96a332d1273754c3967f12db5d6.tar.xz
homework-6-reecepwarner-ac302b109eefa96a332d1273754c3967f12db5d6.zip
init
Diffstat (limited to 'Homework6ReeceWarner')
-rw-r--r--Homework6ReeceWarner/Homework6ReeceWarner.sln31
-rw-r--r--Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj139
-rw-r--r--Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj.filters30
-rw-r--r--Homework6ReeceWarner/contacts.cpp203
-rw-r--r--Homework6ReeceWarner/contacts.h30
-rw-r--r--Homework6ReeceWarner/program.cpp19
6 files changed, 452 insertions, 0 deletions
diff --git a/Homework6ReeceWarner/Homework6ReeceWarner.sln b/Homework6ReeceWarner/Homework6ReeceWarner.sln
new file mode 100644
index 0000000..68f3753
--- /dev/null
+++ b/Homework6ReeceWarner/Homework6ReeceWarner.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34330.188
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework6ReeceWarner", "Homework6ReeceWarner\Homework6ReeceWarner.vcxproj", "{FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}"
+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
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Debug|x64.ActiveCfg = Debug|x64
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Debug|x64.Build.0 = Debug|x64
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Debug|x86.ActiveCfg = Debug|Win32
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Debug|x86.Build.0 = Debug|Win32
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Release|x64.ActiveCfg = Release|x64
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Release|x64.Build.0 = Release|x64
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Release|x86.ActiveCfg = Release|Win32
+ {FC02C88C-1B65-4AAC-84D3-1AB5ACF2AA78}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {949789A5-52B0-4766-842C-0D46E9B4F01A}
+ EndGlobalSection
+EndGlobal
diff --git a/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj b/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj
new file mode 100644
index 0000000..034f39e
--- /dev/null
+++ b/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj
@@ -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>17.0</VCProjectVersion>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectGuid>{fc02c88c-1b65-4aac-84d3-1ab5acf2aa78}</ProjectGuid>
+ <RootNamespace>Homework6ReeceWarner</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="..\contacts.cpp" />
+ <ClCompile Include="..\program.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\contacts.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj.filters b/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.vcxproj.filters
new file mode 100644
index 0000000..a042098
--- /dev/null
+++ b/Homework6ReeceWarner/Homework6ReeceWarner/Homework6ReeceWarner.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="..\program.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\contacts.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\contacts.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/Homework6ReeceWarner/contacts.cpp b/Homework6ReeceWarner/contacts.cpp
new file mode 100644
index 0000000..81992fe
--- /dev/null
+++ b/Homework6ReeceWarner/contacts.cpp
@@ -0,0 +1,203 @@
+#include "contacts.h"
+#include <iostream>
+#include <string>
+
+using std::cout;
+using std::cin;
+using std::endl;
+
+contact contacts[MAX] = {};
+contact emptycontact[MAX] = {}; //this is what I am comparing strings with in the print function
+int numberofcontacts = 0;
+
+contact InputNewContact()
+{
+ cout << "Avoid Using Spaces While Entering Your Street Name" << endl;
+ contact newcontact = {};
+ cout << "First Name: ";
+ cin >> newcontact.FirstName;
+
+ cout << "Last Name: ";
+ cin >> newcontact.LastName;
+
+ cout << "Email: ";
+ cin >> newcontact.Email;
+
+ cout << "Street Number: ";
+ cin >> newcontact.StreetNumber;
+
+ cout << "Street Name: ";
+ cin >> newcontact.StreetName;
+
+ cout << "City: ";
+ cin >> newcontact.city;
+
+ cout << "State: ";
+ cin >> newcontact.State;
+
+ cout << "Zip: ";
+ cin >> newcontact.Zip;
+
+ cout << "\n" << endl;
+
+ return newcontact;
+
+}
+
+
+void printcontacts()
+{
+ for (int x = 0; x < numberofcontacts; x++)
+ {
+ contact empty = emptycontact[x];
+
+ contact existingcontacts = contacts[x];
+ int result;
+ result = strcmp(existingcontacts.FirstName, empty.FirstName); //Compares the cString with an empty one, when it is equal, it prints nothing!!!
+ if (result == 0)
+ {
+ cout << " ";
+ }
+ else
+ {
+ _strupr_s(existingcontacts.FirstName); //permanently changing the string to uppercase
+ _strupr_s(existingcontacts.LastName);
+ cout << "Name " << x << ": " << existingcontacts.FirstName << " " << existingcontacts.LastName << endl;
+ }
+ result = strcmp(existingcontacts.Email, empty.Email);
+ if (result == 0)
+ {
+ cout << " ";
+ }
+ else
+ {
+ _strupr_s(existingcontacts.Email);
+
+ cout << "Email " << x << ": " << existingcontacts.Email << endl;
+ }
+ result = strcmp(existingcontacts.StreetNumber, empty.StreetNumber);
+ if (result == 0)
+ {
+ cout << " ";
+ }
+ else
+ {
+ _strupr_s(existingcontacts.StreetName);
+ cout << "Street Address " << x << ": " << existingcontacts.StreetNumber << " " << existingcontacts.StreetName << endl;
+ }
+ result = strcmp(existingcontacts.city, empty.city);
+ if (result == 0)
+ {
+ cout << " ";
+ }
+ else
+ {
+ _strupr_s(existingcontacts.city);
+ cout << "City " << x << ": " << existingcontacts.city << endl;
+ }
+ result = strcmp(existingcontacts.State, empty.State);
+ if (result == 0)
+ {
+ cout << " ";
+ }
+ else
+ {
+ _strupr_s(existingcontacts.State);
+ cout << "State(xx) " << x << ": " << existingcontacts.State << endl;
+ }
+ if (existingcontacts.Zip == 0)
+ {
+ cout << " " << endl;
+ }
+ else
+ {
+ cout << "Zip Code " << x << ": " << existingcontacts.Zip << endl;
+ cout << "//////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////" << endl; //little divider
+ }
+
+ }
+
+}
+
+
+contact UpdateContact()
+{
+ printcontacts();
+
+ cout << "\n\nWhich contact would you like to update?" << endl;
+
+ int i = 0;
+ cin >> i;
+ while (i >= numberofcontacts) //This while loop prevents the user from overwriting onto an undefined array. I tested it without it and I could write onto any integer that I input
+ {
+ cout << "Invalid Input, Try again" << endl;
+ cin >> i;
+ }
+
+ contacts[i] = InputNewContact();
+ contact updatedcontacts = contacts[i];
+ cout << "\n" << endl;
+
+ return updatedcontacts;
+
+}
+
+
+contact DeleteContactInformation()
+{
+ printcontacts();
+
+ cout << "\n\nWhich contact would you like to delete?" << endl;
+
+ int i = 0; //I didn't add the while loop from the update contact here because there were no negative consequences from inputing an integer larger than the numberofcontacts counter
+ cin >> i;
+ contact deletedcontact = contacts[i];
+ contacts[i] = {NULL};
+
+ for (i; i < numberofcontacts; i++) //shifts deleted contact to the top
+ {
+ contacts[i] = contacts[i + 1];
+ }
+
+ return deletedcontact;
+
+}
+
+
+void menu() {
+ char options = '\0';
+
+ do
+ {
+ cout << "Welcome to the contacts menu\n"
+ << "1)Add New Contact\n"
+ << "2)Update Contact\n"
+ << "3)Print All Contacts\n"
+ << "4)Delete Contact\n"
+ << "5)Exit\n";
+ cin >> options;
+ switch (options)
+ {
+ case('1'):
+ contacts[numberofcontacts++] = InputNewContact();
+ break;
+ case('2'):
+ UpdateContact();
+ break;
+ case('3'):
+ printcontacts();
+ break;
+ case('4'):
+ DeleteContactInformation();
+
+ break;
+ case('5'):
+ cout << "Have a wondeful day!" << endl;
+ break;
+ default:
+ cout << "Invalid Input, Try Again!" << endl;
+ }
+
+ } while (options != '5');
+
+};
diff --git a/Homework6ReeceWarner/contacts.h b/Homework6ReeceWarner/contacts.h
new file mode 100644
index 0000000..9fec259
--- /dev/null
+++ b/Homework6ReeceWarner/contacts.h
@@ -0,0 +1,30 @@
+#ifndef contactsheader
+
+#define contactsheader
+
+#define MAX 100
+
+
+struct contact
+{
+ char FirstName[50] = {};
+ char LastName[50] = {};
+ char Email[100] = {};
+ char StreetNumber[50] = {};
+ char StreetName[100] = {};
+ char city[30] = {};
+ char State[4] = {};
+ int Zip = 0;
+
+
+};
+
+void menu();
+contact InputNewContact();
+contact UpdateContact();
+void printcontacts();
+
+
+
+
+#endif
diff --git a/Homework6ReeceWarner/program.cpp b/Homework6ReeceWarner/program.cpp
new file mode 100644
index 0000000..a888184
--- /dev/null
+++ b/Homework6ReeceWarner/program.cpp
@@ -0,0 +1,19 @@
+//Name:Reece Warner
+//Date:Feb 5th 2024
+//Homework 5
+#include "contacts.h"
+#include <iostream>
+
+
+using std::cout;
+using std::cin;
+using std::endl;
+
+
+int main()
+{
+ menu();
+
+ return 0;
+}
+