-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
88 lines (74 loc) · 2.38 KB
/
main.cpp
File metadata and controls
88 lines (74 loc) · 2.38 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
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
78
79
80
81
82
83
84
85
86
87
88
#include <iostream>
#include <vector>
#include <string>
#include <thread>
#include <chrono>
#include <random>
class CTScan {
public:
CTScan(int id, const std::string& patientName)
: scanId(id), patient(patientName), imageData(generateImageData()) {}
void displayScanInfo() const {
std::cout << "CT Scan ID: " << scanId << "\nPatient: " << patient << "\n";
}
void displayImageData() const {
std::cout << "Image Data (simulated):\n";
for (const auto& row : imageData) {
for (auto val : row) {
std::cout << val << " ";
}
std::cout << "\n";
}
}
private:
int scanId;
std::string patient;
std::vector<std::vector<int>> imageData;
std::vector<std::vector<int>> generateImageData() {
std::vector<std::vector<int>> data(10, std::vector<int>(10));
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 255);
for (auto& row : data) {
for (auto& val : row) {
val = dis(gen);
}
}
return data;
}
};
class CTScannerMachine {
public:
CTScannerMachine(const std::string& location) : machineLocation(location), nextScanId(1) {}
CTScan performScan(const std::string& patientName) {
std::cout << "Starting CT scan for patient: " << patientName << " at " << machineLocation << "...\n";
simulateScanningProcess();
CTScan scan(nextScanId++, patientName);
std::cout << "Scan completed.\n";
return scan;
}
private:
std::string machineLocation;
int nextScanId;
void simulateScanningProcess() {
using namespace std::chrono_literals;
std::cout << "Positioning patient...\n";
std::this_thread::sleep_for(1s);
std::cout << "Rotating scanner...\n";
std::this_thread::sleep_for(2s);
std::cout << "Capturing images...\n";
std::this_thread::sleep_for(2s);
std::cout << "Processing images...\n";
std::this_thread::sleep_for(1s);
}
};
int main() {
CTScannerMachine scanner("City Hospital - Radiology Dept.");
std::string patientName;
std::cout << "Enter patient name for CT scan: ";
std::getline(std::cin, patientName);
CTScan scan = scanner.performScan(patientName);
scan.displayScanInfo();
scan.displayImageData();
return 0;
}