diff options
| author | Connor McDowell <[email protected]> | 2024-02-19 16:16:40 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-19 16:16:40 -0800 |
| commit | 1ea9952ccd3168e629600c48d0ffaee53f9cb158 (patch) | |
| tree | 6290efb7d5ed77e6dc5d3e8cb6ea0ccd094420e1 /Project1 | |
| parent | add deadline (diff) | |
| download | archived-homework-6-connormcdowell275-1ea9952ccd3168e629600c48d0ffaee53f9cb158.tar.xz archived-homework-6-connormcdowell275-1ea9952ccd3168e629600c48d0ffaee53f9cb158.zip | |
.cpps and .hs added
Diffstat (limited to 'Project1')
| -rw-r--r-- | Project1/Contacts.h | 33 | ||||
| -rw-r--r-- | Project1/Project1.sln | 31 | ||||
| -rw-r--r-- | Project1/Project1.vcxproj | 139 | ||||
| -rw-r--r-- | Project1/Project1.vcxproj.filters | 30 | ||||
| -rw-r--r-- | Project1/contacts.cpp | 110 | ||||
| -rw-r--r-- | Project1/program.cpp | 61 |
6 files changed, 404 insertions, 0 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h new file mode 100644 index 0000000..a7d5dda --- /dev/null +++ b/Project1/Contacts.h @@ -0,0 +1,33 @@ +#ifndef CONTACTS_HEADER_H +#define CONTACTS_HEADER_H + + + +// functions + +struct contact +{ + int id = 0; + int count = 0; + char Name[25] = {}; + char Email[100] = {}; + char StreetAddress[35] = {}; + char City[30] = {}; + char State[3] = {}; + int Zip = 0; +}; + +//contact newContact[11]; + + +int menu(); + +char addNew(contact newContact[], size_t MAX, int t); + +void update(contact newContact[], size_t MAX); + +void printAll(contact newContact[], size_t MAX); + + + +#endif CONTACTS_HEADER_H
\ No newline at end of file diff --git a/Project1/Project1.sln b/Project1/Project1.sln new file mode 100644 index 0000000..8a4acd4 --- /dev/null +++ b/Project1/Project1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34511.84 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1.vcxproj", "{33DC98A8-4352-4741-A4C6-6DF3E4C76474}" +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 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Debug|x64.ActiveCfg = Debug|x64 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Debug|x64.Build.0 = Debug|x64 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Debug|x86.ActiveCfg = Debug|Win32 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Debug|x86.Build.0 = Debug|Win32 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Release|x64.ActiveCfg = Release|x64 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Release|x64.Build.0 = Release|x64 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Release|x86.ActiveCfg = Release|Win32 + {33DC98A8-4352-4741-A4C6-6DF3E4C76474}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F1C30495-59AF-4EAE-9580-AD4E58E79B69} + EndGlobalSection +EndGlobal diff --git a/Project1/Project1.vcxproj b/Project1/Project1.vcxproj new file mode 100644 index 0000000..148c9c1 --- /dev/null +++ b/Project1/Project1.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>{33dc98a8-4352-4741-a4c6-6df3e4c76474}</ProjectGuid> + <RootNamespace>Project1</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> + <ClInclude Include="Contacts.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="contacts.cpp" /> + <ClCompile Include="program.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Project1/Project1.vcxproj.filters b/Project1/Project1.vcxproj.filters new file mode 100644 index 0000000..1ea8744 --- /dev/null +++ b/Project1/Project1.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> + <ClInclude Include="Contacts.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="program.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="contacts.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp new file mode 100644 index 0000000..573a8a7 --- /dev/null +++ b/Project1/contacts.cpp @@ -0,0 +1,110 @@ +#include "Contacts.h" +#include <iostream> +#include <list> +#include <vector> + +using std::cin; +using std::cout; +using std::endl; + +int menu() +{ + int c; + + cout << "1. Enter a name\n"; + cout << "2. Delete a name\n"; + cout << "3. List the file\n"; + cout << "4. Quit\n"; + do { + cout <<"\nEnter your choice: "; + cin >> c; + } while (c < 0 || c>4); + return c; +} + +char addNew(contact newContact[], size_t MAX, int t) +{ + for (int i = t; i < MAX; i++) + { + cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; + newContact[i].id = i + 1; + cout << "enter name: " << endl; + cin >> newContact[i].Name; + cout << "enter Email: " << endl; + cin >> newContact[i].Email; + cout << "enter Street Address: " << endl; + cin >> newContact[i].StreetAddress; + cout << "enter city: " << endl; + cin >> newContact[i].City; + cout << "enter State: " << endl; + cin >> newContact[i].State; + cout << "Please enter the next value as a series of numbers" << endl; + cout << "enter Zip: " << endl; + cin >> newContact[i].Zip; + break; + } + + //cout << newContact[i]->Name << "\n" << newContact[i]->Email << "\n" << newContact[i]->StreetAddress << "\n" << newContact[i]->City << "\n" << newContact[i]->State << "\n" << newContact[i]->Zip << endl; + return 0; +} +// print contact i +// name: +// email +// address +// city +// state +// zip + +void update(struct contact newContact[], size_t MAX) +{ + cout << "select a contact to update based on their position in the list (check print all contacts for list position)" << endl; + int c = 0; + cin >> c; + int t = c - 1; + for (int i = t; i < MAX;) + { + cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; + newContact[i].id = c; + cout << "enter name: " << endl; + cin >> newContact[i].Name; + cout << "enter Email: " << endl; + cin >> newContact[i].Email; + cout << "enter Street Address: " << endl; + cin >> newContact[i].StreetAddress; + cout << "enter city: " << endl; + cin >> newContact[i].City; + cout << "enter State: " << endl; + cin >> newContact[i].State; + cout << "Please enter the next value as a series of numbers" << endl; + cout << "enter Zip: " << endl; + cin >> newContact[i].Zip; + break; + } +} + +void printAll(contact newContact[], size_t MAX) +{ + for (int i = 0; i < MAX; ++i) + { + /*for (int t = -1; t < newContact[i].id;) { + break; + }*/ + if (newContact[i].id == 0) { + break; + } + if (newContact[i].id < 0) { + break; + } + if (newContact[i].id > MAX) { + break; + } + + cout << "List number: " << newContact[i].id << endl; + cout << "name: " << newContact[i].Name << endl; + cout << "Email: " << newContact[i].Email << endl; + cout << "Address: " << newContact[i].StreetAddress << endl; + cout << "city: " << newContact[i].City << endl; + cout << "state: " << newContact[i].State << endl; + cout << "Zip: " << newContact[i].Zip << endl; + } +} diff --git a/Project1/program.cpp b/Project1/program.cpp new file mode 100644 index 0000000..4e62543 --- /dev/null +++ b/Project1/program.cpp @@ -0,0 +1,61 @@ +// name: Connor McDowell +// date: 2/19/2024 +// class: CST116 +// reason: homework number 6 + +#include "Contacts.h" +#include <iostream> + +using std::cin; +using std::cout; +using std::endl; + + +// +// +//int main() +//{ +// +// +// +// +// +// return 0; +//} + +int main() +{ + constexpr size_t MAX = 10; + int O = 1; + int t = 0; + contact newContact[MAX]; + while (O == 1) + { + int c = 0; + cout << "1. Enter a contact\n"; + cout << "2. Update a contact\n"; + cout << "3. print all contacts\n"; + cout << "4. Quit\n"; + cout << "\nEnter your choice: " << endl; + cin >> c; + //c = menu(); + if (c == 1) + { + addNew(&newContact[MAX], MAX, t); + ++t; + //cout << t << endl; + } + if (c == 2) + { + update(&newContact[MAX], MAX); + } + if (c == 3) + { + printAll(&newContact[MAX], MAX); + } + if (c == 4) + { + O = 0; + } + } +}
\ No newline at end of file |