#include #include #include //for string using namespace std; int main() { cout << "Please type a year: "; int year {0}; cin >> year; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } if (year <= 0) { cerr << "Sorry, the year has to be positive.\n"; return EXIT_FAILURE; } cout << year << " was the year of the "; year %= 12; //means year = year % 12 if (year == 0) { cout << "monkey"; } else if (year == 1) { cout << "rooster"; } else if (year == 2) { cout << "dog"; } else if (year == 3) { cout << "pig"; } else if (year == 4) { cout << "rat"; } else if (year == 5) { cout << "ox"; } else if (year == 6) { cout << "tiger"; } else if (year == 7) { cout << "hare"; } else if (year == 8) { cout << "dragon"; } else if (year == 9) { cout << "snake"; } else if (year == 10) { cout << "horse"; } else if (year == 11) { cout << "sheep"; } else { cerr << "The %= operator put the bad value " << year << " into year.\n"; return EXIT_FAILURE; } cout << ".\n"; return EXIT_SUCCESS; }