In order to separate patients who are likely infected with the novel corona virus (COVID-19) from other patients, Fafagh clinic Records the temperature of all patients before triaging. According to a new policy of the clinic, the number of patients allowed should not exceed one hundred (100) in day. The policy also stipulates that a patient should be considered for a malaria test when his/her temperature is between 38 degree Celsius and 40 degree Celsius.whilst a patient whose temperature is above 40 degrees Celsius should undergo the Covid 19 test. Although the thermometer used to record the patient’s temperature is calibrated in Fahrenheit, the chart recommended by the policy for determining the test required (malaria/ Covid 19) is specified in Celsius.
1.Draw a flowchart for the above problem
2. Write a program in C++ programming language that:
#include <iostream>
using namespace std;
double FtoC(double F)
{
return (F - 32) * 5 / 9.0;
}
int main()
{
int healthy = 0;
int covid = 0;
int malar = 0;
double temp = 0;
int total = 0;
cout << "Enter up to 100 patients" << endl;
for (int i = 0; i < 100; i++)
{
cout << "Enter patient temperature (enter 0 to exit): ";
cin >> temp;
if (temp == 0) break;
if (FtoC(temp) < 38)
{
cout << "Potencial healthy!" << endl;
healthy++;
}
if (FtoC(temp) >= 38 && FtoC(temp) <= 40)
{
cout << "Potencial malaria!" << endl;
malar++;
}
if (FtoC(temp) > 40)
{
cout << "Potencial covid!" << endl;
covid++;
}
total++;
}
cout << endl;
cout << "Total quantity of patients is: " << total << endl;
cout << "Potencial healthy is: " << healthy << endl;
cout << "Need malaria tests: " << malar << endl;
cout << "Need covid tests: " << covid << endl;
return 0;
}
Comments
Leave a comment