#include #include #include #include using namespace std; int main() { string a[][7] { {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}, //English {"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"}, //Spanish {"Dimoanche", "Lundi", "Mardi", "Mecredi", "Jeudi", "Vendredi", "Samedi"}, //French {"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"} //German }; int n {size(a)}; //the number of languages cout << "Choose your language:\n" << "\t0 for English\n" //"\t" is the tab character << "\t1 for Spanish\n" << "\t2 for French\n" << "\t3 for German\n"; int language {0}; cin >> language; if (language < 0 || language >= n) { cerr << "Sorry, language must be in the range 0 to " << n-1 << " inclusive.\n"; return EXIT_FAILURE; } time_t t {time(nullptr)}; tm *p {localtime(&t)}; int weekday {p->tm_wday}; //in the range 0 to 6 inclusive; 0 is Sunday if (weekday < 0 || weekday >= 6) { cerr << "bad weekday " << weekday << " must be in range 0 to 6 inclusive.\n"; return EXIT_FAILURE; } cout << a[language][weekday] << "\n"; return EXIT_SUCCESS; }