aboutsummaryrefslogtreecommitdiff
path: root/hw6
diff options
context:
space:
mode:
authorraquelc <[email protected]>2024-02-19 21:27:44 -0800
committerraquelc <[email protected]>2024-02-19 21:27:44 -0800
commit7e5ff37a756c6a06a4ce6b6a337a7946d91d8141 (patch)
treeb830d66aaeddf3af0a0d011243368108a4f479e6 /hw6
parentadd deadline (diff)
downloadhomework-6-raquel191-7e5ff37a756c6a06a4ce6b6a337a7946d91d8141.tar.xz
homework-6-raquel191-7e5ff37a756c6a06a4ce6b6a337a7946d91d8141.zip
setup of hw6
Diffstat (limited to 'hw6')
-rw-r--r--hw6/hw6.sln31
-rw-r--r--hw6/hw6/contacts.cpp66
-rw-r--r--hw6/hw6/contacts.h23
-rw-r--r--hw6/hw6/hw6.vcxproj139
-rw-r--r--hw6/hw6/hw6.vcxproj.filters30
-rw-r--r--hw6/hw6/program.cpp71
6 files changed, 360 insertions, 0 deletions
diff --git a/hw6/hw6.sln b/hw6/hw6.sln
new file mode 100644
index 0000000..1500063
--- /dev/null
+++ b/hw6/hw6.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34408.163
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hw6", "hw6\hw6.vcxproj", "{FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}"
+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
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Debug|x64.ActiveCfg = Debug|x64
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Debug|x64.Build.0 = Debug|x64
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Debug|x86.ActiveCfg = Debug|Win32
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Debug|x86.Build.0 = Debug|Win32
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Release|x64.ActiveCfg = Release|x64
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Release|x64.Build.0 = Release|x64
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Release|x86.ActiveCfg = Release|Win32
+ {FEBADE52-EF7F-4BB3-AA89-AA6142CA5C0A}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {D8AB54FE-280C-4BBF-8578-2F6525BE0A77}
+ EndGlobalSection
+EndGlobal
diff --git a/hw6/hw6/contacts.cpp b/hw6/hw6/contacts.cpp
new file mode 100644
index 0000000..c7b4d58
--- /dev/null
+++ b/hw6/hw6/contacts.cpp
@@ -0,0 +1,66 @@
+
+#include <iostream>
+#include "contacts.h"
+using std::cout;
+using std::endl;
+using std::cin;
+
+
+
+contact InputNewcontact() {
+ contact newcontact = {};
+
+ cout << "Name: ";
+ cin >> newcontact.Name;
+
+ cout << "Email: ";
+ cin >> newcontact.Email;
+
+ cout << "StreetAddress: ";
+ cin >> newcontact.StreetAddress;
+
+ cout << "City: ";
+ cin >> newcontact.City;
+
+ cout << "State: ";
+ cin >> newcontact.State;
+
+ cout << "Zip: ";
+ cin >> newcontact.Zip;
+
+ newcontact.Delete = false;
+ return newcontact;
+}
+
+void Printcontacts(contact(&contacts)[10]) {
+ for (auto &x : contacts) {
+ if (!x.Delete)
+ {
+ cout << "Name: " << x.Name << endl;
+ cout << "Email: " << x.Email << endl;
+ cout << "StreetAddress: " << x.StreetAddress << endl;
+ cout << "City: " << x.City << endl;
+ cout << "State: " << x.State << endl;
+ cout << "Zip: " << x.Zip << endl;
+
+ }
+ //cout << endl;
+ }
+}
+
+void update(contact(&contacts)[10]) {
+ //cout << "Print contact to update" << endl;
+
+ Printcontacts(contacts);
+ int num = 0;
+ cout << "Enter contact number to update" << endl;
+ cin >> num;
+
+
+ contacts[num] = InputNewcontact();
+
+
+ }
+
+
+
diff --git a/hw6/hw6/contacts.h b/hw6/hw6/contacts.h
new file mode 100644
index 0000000..44b962d
--- /dev/null
+++ b/hw6/hw6/contacts.h
@@ -0,0 +1,23 @@
+
+#ifndef CONTACTS_H
+#define CONTACTS_H
+
+struct contact {
+ char Name[25] = {};
+ char Email[100] = {};
+ char StreetAddress[35] = {};
+ char City[30] = {};
+ char State[3] = {};
+ int Zip = 0;
+
+ bool Delete = true;
+ bool update = true;
+};
+
+contact InputNewcontact();
+
+void Printcontacts(contact(&contacts)[10]);
+
+void update(contact(&contacts)[10]);
+
+#endif
diff --git a/hw6/hw6/hw6.vcxproj b/hw6/hw6/hw6.vcxproj
new file mode 100644
index 0000000..41558ad
--- /dev/null
+++ b/hw6/hw6/hw6.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>{febade52-ef7f-4bb3-aa89-aa6142ca5c0a}</ProjectGuid>
+ <RootNamespace>hw6</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/hw6/hw6/hw6.vcxproj.filters b/hw6/hw6/hw6.vcxproj.filters
new file mode 100644
index 0000000..45e5aec
--- /dev/null
+++ b/hw6/hw6/hw6.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/hw6/hw6/program.cpp b/hw6/hw6/program.cpp
new file mode 100644
index 0000000..9f6ea04
--- /dev/null
+++ b/hw6/hw6/program.cpp
@@ -0,0 +1,71 @@
+//Name: Raquel Chavez
+//Date: 2/19/24
+//Class: CST 116
+//Homework 6
+
+#include <iostream>
+#include "contacts.h"
+#include <cstdlib>
+using std::cout;
+using std::cin;
+using std::endl;
+
+const int Max = 10;
+
+contact contacts[Max] = {};
+int numberofcontacts = 0;
+
+char c = 'n';
+
+
+
+int main() {
+
+ do {
+ //system("cls");
+ cout << "A. Input New Contact\n";
+ cout << "B. Update contacts\n";
+ cout << "C. Print contacts\n";
+ cout << "press 'x' to exit\n";
+
+ std::cin >> c;
+ switch (c) {
+
+ case'A':
+
+ contacts[numberofcontacts++] = InputNewcontact();
+ /*
+ contact contact = InputNewcontact();
+ contacts[numberofcontacts] = contact;
+ numberofcontacts++;
+ */
+ break;
+ case 'B':
+ //pick contact then update new info
+ //print contacts with elemt
+ //prompt for user to input element
+ //pass that contact to a function to update
+ cout << "Print contact to update" << endl;
+ update(contacts);
+
+
+ break;
+ case'C':
+
+ Printcontacts(contacts);
+
+ break;
+ case 'x':
+ //exit
+ cout << "Goodbye";
+ break;
+ default:
+ cout << "That was bad input\n";
+ }
+
+ } while (c != 'x');
+
+ return 0;
+}
+
+