-
Notifications
You must be signed in to change notification settings - Fork 0
/
retreive.cpp
56 lines (54 loc) · 1.51 KB
/
retreive.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
#include <iostream>
#include <string>
#include <fstream>
#include "doctor/doctor.cpp"
#include "patient/patient.cpp"
#include "helper/helper.cpp"
using namespace std;
void retreive() {
loop:
string type;
string data;
cout << "Enter type of person(Doctor/Patient/Helper): ";
cin >> type;
if (type == "Doctor" || type == "doctor") {
cout << "Enter Serial No. of Doctor to get data: ";
cin >> data;
string file = "doctor/" + (data) + ".dat";
ifstream in;
in.open(file);
string st;
while (in.eof() == 0) {
getline(in, st);
cout << st << "\n";
}
}
else if (type == "Patient" || type == "petient") {
cout << "Enter Patient No. of Patient to get data: ";
cin >> data;
string file = "patient/" + (data) + ".dat";
ifstream in;
in.open(file);
string st;
while (in.eof() == 0) {
getline(in, st);
cout << st << "\n";
}
}
else if (type == "Helper" || type == "helper") {
cout << "Enter Serial No. of Helper to get data: ";
cin >> data;
string file = "helper/" + (data) + ".dat";
ifstream in;
in.open(file);
string st;
while (in.eof() == 0) {
getline(in, st);
cout << st << "\n";
}
}
else {
cout << "No such record found, enter correct credentials\n";
goto loop;
}
}