#include #include #include #include using namespace std; int main() { int n {4}; //number of languages cout << "Choose your language:\n" << "\t0 for English\n" << "\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 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; } if (language == 0) { //English if (weekday == 0) { cout << "Sunday"; } else if (weekday == 1) { cout << "Monday"; } else if (weekday == 2) { cout << "Tuesday"; } else if (weekday == 3) { cout << "Wednesday"; } else if (weekday == 4) { cout << "Thursday"; } else if (weekday == 5) { cout << "Friday"; } else if (weekday == 6) { cout << "Saturday"; } } else if (language == 1) { //Spanish if (weekday == 0) { cout << "Domingo"; } else if (weekday == 1) { cout << "Lunes"; } else if (weekday == 2) { cout << "Martes"; } else if (weekday == 3) { cout << "Miercoles"; } else if (weekday == 4) { cout << "Jueves"; } else if (weekday == 5) { cout << "Viernes"; } else if (weekday == 6) { cout << "Sabado"; } } else if (language == 3) { //French if (weekday == 0) { cout << "Dimoanche"; } else if (weekday == 1) { cout << "Lundi"; } else if (weekday == 2) { cout << "Mardi"; } else if (weekday == 3) { cout << "Mecredi"; } else if (weekday == 4) { cout << "Juedi"; } else if (weekday == 5) { cout << "Vendredi"; } else if (weekday == 6) { cout << "Samedi"; } } else { //German if (weekday == 0) { cout << "Sonntag"; } else if (weekday == 1) { cout << "Montag"; } else if (weekday == 2) { cout << "Dienstag"; } else if (weekday == 3) { cout << "Mittwoch"; } else if (weekday == 4) { cout << "Donnerstag"; } else if (weekday == 5) { cout << "Freitag"; } else if (weekday == 6) { cout << "Samstag"; } } cout << "\n"; return EXIT_SUCCESS; }