-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiseaseClassificationExpertSystem.cpp
More file actions
41 lines (37 loc) · 1.03 KB
/
Copy pathDiseaseClassificationExpertSystem.cpp
File metadata and controls
41 lines (37 loc) · 1.03 KB
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
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
map<string, set<string>> diseases;
void initialize() {
diseases["influenza"] = {"fever", "cough", "body ache", "fatigue"};
diseases["cold"] = {"sneeze", "cough", "runny nose", "mild fever"};
diseases["allergy"] = {"sneeze", "itchy eyes", "runny nose", "no fever"};
}
string diagnose(const set<string>& symptoms) {
for (const auto& entry : diseases) {
if (includes(symptoms.begin(), symptoms.end(),
entry.second.begin(), entry.second.end())) {
return entry.first;
}
}
return "unknown condition";
}
int main() {
initialize();
set<string> patient = {"sneeze", "cough", "runny nose", "mild fever"};
cout << "Diagnosis: " << diagnose(patient) << '\n';
return 0;
}