#include #include #include using namespace std; class bloodPressure { public: // Data members: int systolic; int diastolic; // Member functions: void print() const; // Print the blood pressure reading void increase(int s, int d); // Increase systolic and diastolic values void next(); // Simulate the next day's reading (basic fluctuation) void next(int n); // Simulate n days of readings }; int main() { // Output a sample blood pressure reading const bloodPressure normal {120, 80}; normal.print(); cout << " is a normal reading.\n"; // Create a reading for today (randomized a bit) srand(static_cast(time(nullptr))); bloodPressure today {110 + rand() % 21, 70 + rand() % 16}; // systolic: 110–130, diastolic: 70–85 today.print(); cout << " is today's reading.\n"; // Simulate tomorrow's reading bloodPressure tomorrow {today}; tomorrow.next(); tomorrow.print(); cout << " is tomorrow's reading.\n"; // Simulate reading after a week bloodPressure nextWeek {today}; nextWeek.next(7); nextWeek.print(); cout << " is next week's reading.\n"; return EXIT_SUCCESS; } void bloodPressure::print() const { cout << systolic << "/" << diastolic << " mmHg"; } void bloodPressure::increase(int s, int d) { systolic += s; diastolic += d; } void bloodPressure::next() { // Simulate small random fluctuation systolic += (rand() % 5) - 2; // Change between -2 and +2 diastolic += (rand() % 5) - 2; } void bloodPressure::next(int n) { for (int i = 0; i < n; ++i) { next(); // Advance one day } }