#include #include #include using namespace std; struct dining_option { string name; bool mon_thurs; //True if the dining option is open that day, false if it is closed bool fri; bool sat; bool sun; }; void f(dining_option *p, int current_day); int main() { dining_option Argo {"Argo Tea", true, false, true, false}; dining_option Community {"Community Dining Hall", true, true, true, true}; dining_option RamCaf {"Ram Caf", true, false, true, false}; //Ask the operating system for the current date, time, and day of the week time_t t = time(nullptr); tm *localTime = localtime(&t); int current_day = localTime->tm_wday; //Record day of the week as an int (0-6) //Pass the addresses of the structures to the function f(&Argo, current_day); f(&Community, current_day); f(&RamCaf, current_day); return EXIT_SUCCESS; } //Check which dining_options are set to true for the current_day void f(dining_option *p, int current_day) { if (current_day >= 1 && current_day <= 4) { if (p->mon_thurs == true) { cout << p->name << " is open today.\n"; } else { cout << p->name << " is closed today.\n"; } } if (current_day == 5) { if (p->fri == true) { cout << p->name << " is open today.\n"; } else { cout << p->name << " is closed today.\n"; } } if (current_day == 6) { if (p->sat == true) { cout << p->name << " is open today.\n"; } else { cout << p->name << " is closed today.\n"; } } if (current_day == 0) { if (p->sun == true) { cout << p->name << " is open today.\n"; } else { cout << p->name << " is closed today.\n"; } } }