-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOption2.cpp
77 lines (62 loc) · 1.47 KB
/
Option2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include "Person.h"
#include "PersonFile.h"
#include "Vehicle.h"
#include "VehicleFile.h"
using namespace std;
Person SearchBySSN(const string & aString);
void DisplayPerson();
Vehicle VSearchBySSN(const string & aString);
void DisplayVehicle();
string UserWait();
void Option2()
{
Person * pPerson = new Person;
PersonFile * pPersonFile = new PersonFile;
Vehicle * pVehicle = new Vehicle;
VehicleFile * pVehicleFile = new VehicleFile;
string inSSN;
while(true)
{
system("clear");
cout << "\t\t\t* * * Option 2: Search by SSN * * *" << endl << endl;
cout << "\t\tEnter a Social Security Number (or Q to Quit): ";
getline(cin, inSSN);
cin.sync();
if(inSSN[0] == 'q' || inSSN[0] == 'Q')
{
break;
}
*pPerson = pPersonFile->SearchBySSN(inSSN);
*pVehicle = pVehicleFile->VSearchBySSN(inSSN);
if(!(pPerson->IsFound()))
{
cout << endl << endl;
cout << "\t\tSocial Security Number was not found" << endl;
UserWait();
continue;
}
if(pPerson->IsFound() && pVehicle->IsFound())
{
cout << endl << endl;
pPerson->DisplayPerson();
cout << endl << endl;
pVehicle->DisplayVehicle();
UserWait();
}
if(pPerson->IsFound() && !(pVehicle->IsFound()))
{
cout << endl << endl;
pPerson->DisplayPerson();
cout << endl << endl << "\t\t No Vehicle";
UserWait();
}
}
delete pPerson;
delete pPersonFile;
delete pVehicle;
delete pVehicleFile;
return;
}