#include #include #include using namespace std; int main() { // Rows = languages // 0 = English, 1 = Akan (Twi), 2 = French const string weather[][4] { // sunny, rainy, cloudy, windy {"Sunny", "Rainy", "Cloudy", "Windy"}, // English {"Owia wō", "Osuo retoa", "Mununkum", "Mframa retu"}, // Akan {"Ensoleillé", "Pluvieux", "Nuageux", "Venteux"} // French }; const int nLang {3}; // number of languages const int nCond {4}; // number of weather types cout << "Choose language:\n" << "\t0 = English\n" << "\t1 = Akan (Twi)\n" << "\t2 = French\n"; int lang {0}; cin >> lang; if (!cin) { cerr << "Could not read number.\n"; return EXIT_FAILURE; } if (lang < 0 || lang >= nLang) { cerr << "Language must be between 0 and " << nLang - 1 << ".\n"; return EXIT_FAILURE; } cout << "Choose weather type:\n" << "\t0 = sunny\n" << "\t1 = rainy\n" << "\t2 = cloudy\n" << "\t3 = windy\n"; int cond {0}; cin >> cond; if (!cin) { cerr << "Could not read number.\n"; return EXIT_FAILURE; } if (cond < 0 || cond >= nCond) { cerr << "Weather must be between 0 and " << nCond - 1 << ".\n"; return EXIT_FAILURE; } cout << "Weather today: " << weather[lang][cond] << "\n"; return EXIT_SUCCESS; }