aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBensProgramma <[email protected]>2021-12-07 15:12:11 -0800
committerGitHub <[email protected]>2021-12-07 15:12:11 -0800
commite96913204fa3844a9268cca24681687df975fe66 (patch)
treef4a8ffe22b624429ed5f15688a6cd357e9f165b6
parentFinal Update (diff)
downloadcst116-lab9-bensprogramma-e96913204fa3844a9268cca24681687df975fe66.tar.xz
cst116-lab9-bensprogramma-e96913204fa3844a9268cca24681687df975fe66.zip
RUNS
-rw-r--r--CST116F2021-Lab9/RUNS.txt191
1 files changed, 143 insertions, 48 deletions
diff --git a/CST116F2021-Lab9/RUNS.txt b/CST116F2021-Lab9/RUNS.txt
index 03ceb73..49cb755 100644
--- a/CST116F2021-Lab9/RUNS.txt
+++ b/CST116F2021-Lab9/RUNS.txt
@@ -118,6 +118,7 @@ Press any key to close this window . . .
+
// /// 11.14 Programming Exercises pp 337 - 338 #4 ///////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
@@ -146,7 +147,7 @@ void Update();
int main()
{
// READ THE FILE IN
- fin.open("INFO2.txt");
+ fin.open("INFO.txt");
while (fin && !fin.eof())
{
fin >> first[num_records]
@@ -155,6 +156,7 @@ int main()
>> bd[num_records];
num_records++;
}
+
fin.close();
DisplayMenu();
@@ -207,11 +209,31 @@ void DisplayMenu()
void Find()
{
+ string temp = " ";
+ cout << "Enter the Last Name to search for: ";
+ cin >> temp;
+
+ string subString{ temp };
+ int found = 0;
+ for (int k = 0; k <= num_records - 1; k++)
+ {
+ if (last[k] == subString)
+ {
+ cout << "found: " << first[k] << " " << last[k] << "\t\tph: " << ph[k] << "\tDOB: " << bd[k] << "\n";
+ found++;
+ }
+ }
+ if (found == 0)
+ cout << "Account not found.\n";
+
+ cout << "\n\n";
+ DisplayMenu();
}
+
+
void Add()
{
-
cout << "Last Name: ";
cin >> last[num_records];
cout << "First Name: ";
@@ -225,7 +247,6 @@ void Add()
cout << "\n\n";
DisplayMenu();
-
}
void Edit()
{
@@ -281,8 +302,9 @@ void Sort()
{
swapped = false;
j++;
- for (int i = 0; i < num_records - 1; i++)
+ for (int i = 0; i < num_records-1; i++)
{
+ //if (last[i]!=null)
if (last[i] > (last[i + 1]))
{
tmp1 = last[i]; tmp2 = first[i]; tmp3 = ph[i]; tmp4 = bd[i];
@@ -299,33 +321,62 @@ void Update()
{
Sort();
- fout.open("INFO2.txt");
- for (int i = 0; i <=num_records-1; i++)
+ fout.open("INFO.txt");
+ for (int i = 0; i <=num_records-2; i++)
fout << first[i] << " " << last[i] << " " << ph[i] <<" "<< bd[i] << endl;
//fout << first[i] << "\n" << last[i] << "\n" << ph[i] << "\n" << bd[i] << "\n";
-
+ fout << first[num_records-1] << " " << last[num_records - 1] << " " << ph[num_records - 1] << " " << bd[num_records - 1];
fout.close();
-
}
// ///////////////////// RUNS ///////////////////////
+ *** ORIGINAL FILE ***
+Kevin Ashes ph: 765-949-7343 DOB: 06/25/1995
+Billy Bobson ph: 951-652-3625 DOB: 12/12/1912
+Molly Brown ph: 432-489-7654 DOB: 12/12/1912
+David Cackroche ph: 317-981-2527 DOB: 12/25/1928
+Kim Cares ph: 343-117-2222 DOB: 11/30/2005
+Prince Cheryl ph: 983-554-9000 DOB: 04/12/1988
+Trish Dish ph: 798-654-9844 DOB: 06/12/2001
+Will Kusick ph: 232-451-2322 DOB: 01/01/2001
+Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
+Robbie Roberts ph: 317-248-9856 DOB: 03/11/1974
+John Smith ph: 123-209-9765 DOB: 11/12/1975
+Jon Smith ph: 812-257-9854 DOB: 02/29/1984
+James Smyth ph: 650-123-4528 DOB: 05/27/1965
+Keel Water ph: 762-848-6543 DOB: 03/25/1997
+Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
+
+
+ *** DISPLAY FROM PROGRAM ***
-****************************************************************************
-// Original File:
+ Menu Driven Database
+************************************************
+ 1) Find a person's information
+ 2) Add a person to the database
+ 3) Edit a person's information
+ 4) Display all records to the screen
+ 5) Quit
+**************************************************
+Enter the number of the option you desire: 4
+
+All of the current records:
1. Kevin Ashes ph: 765-949-7343 DOB: 06/25/1995
2. Billy Bobson ph: 951-652-3625 DOB: 12/12/1912
3. Molly Brown ph: 432-489-7654 DOB: 12/12/1912
4. David Cackroche ph: 317-981-2527 DOB: 12/25/1928
5. Kim Cares ph: 343-117-2222 DOB: 11/30/2005
-6. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
-7. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
-8. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
-9. Cheryl Prince ph: 983-554-9000 DOB: 04/12/1988
-10. John Smith ph: 123-209-9765 DOB: 11/12/1975
-11. Keel Water ph: 762-848-6543 DOB: 03/25/1997
-12. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
-*****************************************************************************
+6. Prince Cheryl ph: 983-554-9000 DOB: 04/12/1988
+7. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
+8. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
+9. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
+10. Robbie Roberts ph: 317-248-9856 DOB: 03/11/1974
+11. John Smith ph: 123-209-9765 DOB: 11/12/1975
+12. Jon Smith ph: 812-257-9854 DOB: 02/29/1984
+13. James Smyth ph: 650-123-4528 DOB: 05/27/1965
+14. Keel Water ph: 762-848-6543 DOB: 03/25/1997
+15. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
Menu Driven Database
@@ -337,10 +388,10 @@ void Update()
5) Quit
**************************************************
Enter the number of the option you desire: 2
-Last Name: Smith
-First Name: John
-ph #: 812-445-9867
-Date Of Birth: 02-29-1984
+Last Name: Walter
+First Name: Will
+ph #: 503-260-5624
+Date Of Birth: 06/15/1982
Menu Driven Database
@@ -359,14 +410,17 @@ All of the current records:
3. Molly Brown ph: 432-489-7654 DOB: 12/12/1912
4. David Cackroche ph: 317-981-2527 DOB: 12/25/1928
5. Kim Cares ph: 343-117-2222 DOB: 11/30/2005
-6. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
-7. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
-8. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
-9. Cheryl Prince ph: 983-554-9000 DOB: 04/12/1988
-10. John Smith ph: 123-209-9765 DOB: 11/12/1975
-11. John Smith ph: 812-445-9867 DOB: 02-29-1984
-12. Keel Water ph: 762-848-6543 DOB: 03/25/1997
-13. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
+6. Prince Cheryl ph: 983-554-9000 DOB: 04/12/1988
+7. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
+8. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
+9. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
+10. Robbie Roberts ph: 317-248-9856 DOB: 03/11/1974
+11. John Smith ph: 123-209-9765 DOB: 11/12/1975
+12. Jon Smith ph: 812-257-9854 DOB: 02/29/1984
+13. James Smyth ph: 650-123-4528 DOB: 05/27/1965
+14. Will Walter ph: 503-260-5624 DOB: 06/15/1982
+15. Keel Water ph: 762-848-6543 DOB: 03/25/1997
+16. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
Menu Driven Database
@@ -385,21 +439,24 @@ All of the current records:
3. Molly Brown ph: 432-489-7654 DOB: 12/12/1912
4. David Cackroche ph: 317-981-2527 DOB: 12/25/1928
5. Kim Cares ph: 343-117-2222 DOB: 11/30/2005
-6. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
-7. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
-8. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
-9. Cheryl Prince ph: 983-554-9000 DOB: 04/12/1988
-10. John Smith ph: 123-209-9765 DOB: 11/12/1975
-11. John Smith ph: 812-445-9867 DOB: 02-29-1984
-12. Keel Water ph: 762-848-6543 DOB: 03/25/1997
-13. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
+6. Prince Cheryl ph: 983-554-9000 DOB: 04/12/1988
+7. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
+8. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
+9. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
+10. Robbie Roberts ph: 317-248-9856 DOB: 03/11/1974
+11. John Smith ph: 123-209-9765 DOB: 11/12/1975
+12. Jon Smith ph: 812-257-9854 DOB: 02/29/1984
+13. James Smyth ph: 650-123-4528 DOB: 05/27/1965
+14. Will Walter ph: 503-260-5624 DOB: 06/15/1982
+15. Keel Water ph: 762-848-6543 DOB: 03/25/1997
+16. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
-Enter the # of the record you would like to edit: 9
-Last Name: Cheryl
-First Name: Prince
-ph #: 983-554-9000
-Date Of Birth: 04/12/1988
+Enter the # of the record you would like to edit: 15
+Last Name: Whater
+First Name: Keel
+ph #: 762-848-6543
+Date Of Birth: 03/25/1997
Menu Driven Database
@@ -422,10 +479,27 @@ All of the current records:
7. Trish Dish ph: 798-654-9844 DOB: 06/12/2001
8. Will Kusick ph: 232-451-2322 DOB: 01/01/2001
9. Anthony Lei ph: 934-433-9843 DOB: 07/23/1982
-10. John Smith ph: 123-209-9765 DOB: 11/12/1975
-11. John Smith ph: 812-445-9867 DOB: 02-29-1984
-12. Keel Water ph: 762-848-6543 DOB: 03/25/1997
-13. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
+10. Robbie Roberts ph: 317-248-9856 DOB: 03/11/1974
+11. John Smith ph: 123-209-9765 DOB: 11/12/1975
+12. Jon Smith ph: 812-257-9854 DOB: 02/29/1984
+13. James Smyth ph: 650-123-4528 DOB: 05/27/1965
+14. Will Walter ph: 503-260-5624 DOB: 06/15/1982
+15. Keel Whater ph: 762-848-6543 DOB: 03/25/1997
+16. Tim Wheeler ph: 239-349-3458 DOB: 01/01/1999
+
+
+ Menu Driven Database
+************************************************
+ 1) Find a person's information
+ 2) Add a person to the database
+ 3) Edit a person's information
+ 4) Display all records to the screen
+ 5) Quit
+**************************************************
+Enter the number of the option you desire: 1
+Enter the Last Name to search for: Smith
+found: John Smith ph: 123-209-9765 DOB: 11/12/1975
+found: Jon Smith ph: 812-257-9854 DOB: 02/29/1984
Menu Driven Database
@@ -438,6 +512,27 @@ All of the current records:
**************************************************
Enter the number of the option you desire: 5
Thank you, Goodbye!
-C:\Users\Lenovo\source\repos\Lab9_Schroeder\Debug\Lab9_Schroeder.exe (process 14904) exited with code 0.
+C:\Users\Lenovo\source\repos\Lab9_Schroeder\Debug\Lab9_Schroeder.exe (process 16516) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
+
+
+
+
+ *** NEW FILE DATA ***
+Kevin Ashes 765-949-7343 06/25/1995
+Billy Bobson 951-652-3625 12/12/1912
+Molly Brown 432-489-7654 12/12/1912
+David Cackroche 317-981-2527 12/25/1928
+Kim Cares 343-117-2222 11/30/2005
+Prince Cheryl 983-554-9000 04/12/1988
+Trish Dish 798-654-9844 06/12/2001
+Will Kusick 232-451-2322 01/01/2001
+Anthony Lei 934-433-9843 07/23/1982
+Robbie Roberts 317-248-9856 03/11/1974
+John Smith 123-209-9765 11/12/1975
+Jon Smith 812-257-9854 02/29/1984
+James Smyth 650-123-4528 05/27/1965
+Will Walter 503-260-5624 06/15/1982
+Keel Whater 762-848-6543 03/25/1997
+Tim Wheeler 239-349-3458 01/01/1999