diff options
| author | Yana Blashchishina <[email protected]> | 2024-02-18 18:48:07 -0800 |
|---|---|---|
| committer | Yana Blashchishina <[email protected]> | 2024-02-18 18:48:07 -0800 |
| commit | 9ca9d19dca5331a8db88e657958c27ba71f3bdab (patch) | |
| tree | fb6ae3590aa944c745dcb1602823750747c4cd40 /Homework6 | |
| parent | add deadline (diff) | |
| download | homework-6-yanablash-9ca9d19dca5331a8db88e657958c27ba71f3bdab.tar.xz homework-6-yanablash-9ca9d19dca5331a8db88e657958c27ba71f3bdab.zip | |
init
Diffstat (limited to 'Homework6')
| -rw-r--r-- | Homework6/Homework6.sln | 31 | ||||
| -rw-r--r-- | Homework6/Homework6/Homework6.vcxproj | 139 | ||||
| -rw-r--r-- | Homework6/Homework6/Homework6.vcxproj.filters | 30 | ||||
| -rw-r--r-- | Homework6/Homework6/contacts.cpp | 77 | ||||
| -rw-r--r-- | Homework6/Homework6/contacts.h | 16 | ||||
| -rw-r--r-- | Homework6/Homework6/program.cpp | 56 |
6 files changed, 349 insertions, 0 deletions
diff --git a/Homework6/Homework6.sln b/Homework6/Homework6.sln new file mode 100644 index 0000000..23cec41 --- /dev/null +++ b/Homework6/Homework6.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}") = "Homework6", "Homework6\Homework6.vcxproj", "{3F49BA85-076D-4D93-8DE8-71B1C2B06958}" +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 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Debug|x64.ActiveCfg = Debug|x64 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Debug|x64.Build.0 = Debug|x64 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Debug|x86.ActiveCfg = Debug|Win32 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Debug|x86.Build.0 = Debug|Win32 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Release|x64.ActiveCfg = Release|x64 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Release|x64.Build.0 = Release|x64 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Release|x86.ActiveCfg = Release|Win32 + {3F49BA85-076D-4D93-8DE8-71B1C2B06958}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {56A1FAC3-B629-4FAA-B30A-855F60FAAF31} + EndGlobalSection +EndGlobal diff --git a/Homework6/Homework6/Homework6.vcxproj b/Homework6/Homework6/Homework6.vcxproj new file mode 100644 index 0000000..e9aea82 --- /dev/null +++ b/Homework6/Homework6/Homework6.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> + <ItemGroup> + <ClInclude Include="contacts.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="contacts.cpp" /> + <ClCompile Include="program.cpp" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>17.0</VCProjectVersion> + <Keyword>Win32Proj</Keyword> + <ProjectGuid>{3f49ba85-076d-4d93-8de8-71b1c2b06958}</ProjectGuid> + <RootNamespace>Homework6</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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Homework6/Homework6/Homework6.vcxproj.filters b/Homework6/Homework6/Homework6.vcxproj.filters new file mode 100644 index 0000000..a0758c0 --- /dev/null +++ b/Homework6/Homework6/Homework6.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/Homework6/Homework6/contacts.cpp b/Homework6/Homework6/contacts.cpp new file mode 100644 index 0000000..0e7a19d --- /dev/null +++ b/Homework6/Homework6/contacts.cpp @@ -0,0 +1,77 @@ +#include <iostream> +#include "Contacts.h" + + +using std::cout; +using std::cin; +using std::endl; + +void addContact(Contact contacts[], int& numContacts) { + if (numContacts < 100) { + Contact& newContact = contacts[numContacts]; + + cout << "Enter Name: "; + cin >> newContact.Name; + + cout << "Enter Email: "; + cin >> newContact.Email; + + cout << "Enter Street Address: "; + cin >> newContact.StreetAddress; + + cout << "Enter City: "; + cin >> newContact.City; + + cout << "Enter State: "; + cin >> newContact.State; + + cout << "Enter Zip Code: "; + cin >> newContact.Zip; + } +} + + + +void updateContact(Contact contacts[], int& numContacts) { + int num; + cin >> num; + Contact& contactToUpdate = contacts[num]; + + cout << "Enter new Name: "; + cin >> contactToUpdate.Name; + + cout << "Enter new Email: "; + cin >> contactToUpdate.Email; + + cout << "Enter new Street Address: "; + cin >> contactToUpdate.StreetAddress; + + cout << "Enter New City: "; + cin >> contactToUpdate.City; + + cout << "Enter New State: "; + cin >> contactToUpdate.State; + + cout << "Enter new Zip Code: "; + cin >> contactToUpdate.Zip; + + cout << "Contact Updated"; +} + +void printContact(const Contact contacts[], int numContacts) { + if (numContacts == 0) { + cout << "No contacts available"; + } + else { + cout << "Contacts: "; + for (int i = 0; i < numContacts; ++i) { + const Contact& contact = contacts[i]; + cout << "Name: " << contact.Name << " x "; + cout << "Email: " << contact.Email << " x "; + cout << "Street Address: " << contact.StreetAddress << " x "; + cout << "City: " << contact.City << " x "; + cout << " State: " << contact.State << " x "; + cout << " Zip Code: " << contact.Zip << " x "; + } + } +}
\ No newline at end of file diff --git a/Homework6/Homework6/contacts.h b/Homework6/Homework6/contacts.h new file mode 100644 index 0000000..d520158 --- /dev/null +++ b/Homework6/Homework6/contacts.h @@ -0,0 +1,16 @@ +#ifndef CONTACTS_H +#define CONTACTS_H + +struct Contact { + char Name[25] = {}; + char Email[100] = {}; + char StreetAddress[35] = {}; + char City[30] = {}; + char State[2] = {}; + int Zip = 0; +}; + +void addContact(Contact contacts[], int& numContacts); +void updateContact(Contact contacts[], int& numContacts); +void printContact(const Contact contacts[], int numContacts); +#endif
\ No newline at end of file diff --git a/Homework6/Homework6/program.cpp b/Homework6/Homework6/program.cpp new file mode 100644 index 0000000..530021e --- /dev/null +++ b/Homework6/Homework6/program.cpp @@ -0,0 +1,56 @@ +// Name: Yana Blashchishina +// Date: 2/18/2024 +// Class: CST116 +// Assignment: Homework 6 + + +#include<iostream> +#include "Contacts.h" + + +using std::cout; +using std::cin; +using std::endl; + +int main() { + Contact contacts[10]; + int numContacts = 0; + + while (true) { + cout << " Menu Options: "; + cout << "1. Add New Contact "; + cout << "2. Update Contact "; + cout << "3. Print All Contacts "; + cout << "4. Exit "; + + + int option; + cout << "Enter your option: "; + cin >> option; + + + switch (option) { + case 1: + addContact(contacts, numContacts); + break; + + case 2: + updateContact(contacts, numContacts); + break; + + case 3: + printContact(contacts, numContacts); + break; + + case 4: + cout << "Exiting"; + return 0; + default: + cout << "Try Again"; + } + } + + + + return 0; +}
\ No newline at end of file |