//#define CONTROL_AGE
//#define CONTROL_PREGNANT
//#define ORDER_QUEUE
using namespace std;
struct Patient {
char name[40];
#ifdef CONTROL_AGE
int age;
#endif
char gender;
#ifdef CONTROL_PREGNANT
bool pregnant;
#endif
bool vaccinated;
} p[4] = { { "Alice", 'f', false },
{ "Maria", 'f', false },
{ "Jessica", 'f', false },
{ "Vivian", 'f', false } };
#ifdef ORDER_QUEUE
void orderPatientQueue() {
//This algorithm sorts the p patients array according to age.
//At the end of the algorithm, the oldest patient becomes the first element of the array
//and the youngest patient the last.
}
#endif
void vaccinate() {
#ifdef ORDER_QUEUE
orderPatientQueue ( );
#endiF
#ifdef CONTROL_AGE
int vaccinateAgeLimit = 40;
#endif
#ifdef CONTROL_PREGNANT
int pregnantTotal = 0;
#endif
int i, n = 4;
for ( i = 0; i < n; i ++ ) {
if ( !p[i].vaccinated ) {
#ifdef CONTROL_AGE
if ( p[i].age > vaccinateAgeLimit ) {
#endif
#ifdef CONTROL_PREGNANT
if ( !p[i].pregnant ) {
#endif
printf( "patient's name: %s \n", p[i].name );
#ifdef CONTROL_AGE
printf( "Age: %d \n", p[i].age );
#endif
printf( "Gender: %c \n", p[i].gender );
#ifdef CONTROL_PREGNANT
if ( p[i].gender == 'f' && p[i].pregnant )
printf( "Pregnant: Yes \n" );
#endif
p[i].vaccinated = true;
break;
#ifdef CONTROL_PREGNANT
} else {
printf( "Pregnant pacients cannot be vaccinated! \n" );
pregnantTotal ++;
}
#endif
#ifdef CONTROL_AGE
} else
printf( "Insufficient age to vaccinate: %d \n", p[i].name );
#endif
}
}
}
int main(){
vaccinate();
return 0;
}