aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-21 13:36:20 -0800
committerConnor McDowell <[email protected]>2024-02-21 13:36:20 -0800
commitc5fbd749a75f5984885197def2a4a65eeead513e (patch)
tree7bf6b5d6be9a2b948e8c4dde0830376f0baaf611
parentcomments added. attempting new try to get doubling to work. (diff)
downloadhomework-6-connormcdowell275-c5fbd749a75f5984885197def2a4a65eeead513e.tar.xz
homework-6-connormcdowell275-c5fbd749a75f5984885197def2a4a65eeead513e.zip
added more comments and plans to do
-rw-r--r--Project1/Contacts.h1
-rw-r--r--Project1/contacts.cpp32
2 files changed, 17 insertions, 16 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h
index 220e0f8..b59fbc5 100644
--- a/Project1/Contacts.h
+++ b/Project1/Contacts.h
@@ -7,6 +7,7 @@
struct contact
{
+ bool a = true;
size_t id = 0;
int count = 0;
char Name[25]{};
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp
index 2e95c97..79f048c 100644
--- a/Project1/contacts.cpp
+++ b/Project1/contacts.cpp
@@ -7,23 +7,19 @@ 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, size_t t)
{
+ //using couts to prompt using for all parts of newContact struct.
+ //update plans: check for newContact[i].bool value, if false, use a modified void update
+ //(new function thats just void update with different couts) to be called with an if statement.
+ //or another for.
+ //for (size_t i = 0; i < max/length; i++)
+ //if (bool == false)
+ // void mod_update
+ // to check for any "empty"/deleted contacts before adding one. if bool == false should include break after mod_update.
+ //CURRENTLY WORKS
for (size_t i = t ; i < MAX; i++)
{
newContact[i].id = i+1;
@@ -59,6 +55,8 @@ char addNew(contact newContact[], size_t MAX, size_t t)
void update(contact newContact[], size_t MAX)
{
+ //uses input based on list number from print (though when delete is made will be using that id/name print) to update the values of.
+ //CURRENTLY WORKING
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;
@@ -87,6 +85,8 @@ void update(contact newContact[], size_t MAX)
void printAll(contact newContact[], size_t MAX)
{
+ //prints all info but count and bool for every existing (non trash value filled) contact struct
+ //CURRENTLY WORKING
for (int i = 0; i < MAX; ++i)
{
/*for (int t = -1; t < newContact[i].id;) {
@@ -130,7 +130,7 @@ void contact_double(contact*& newContact, size_t& MAX, size_t t)
void delete_contact(contact newContact[])
{
- //Work in progress, add BOOL (0) to struct, when this is selected print id list with respective names
- //then take input of id list number and set BOOL to 1
+ //Work in progress, add BOOL (true) to struct, when this is selected print id list with respective names
+ //then take input of id list number and set bool to false
//add to new part to addNew: if bool != 0 then copy and paste update code w/addNew couts
} \ No newline at end of file