#include #include #include using namespace std; int main(){ const string days[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; int cday {0}; cout << "Please enter the current day of the week as a number where Monday is 0 and Sunday is 6.\n"; cin >> cday; if (!cin) { cerr << "Sorry, that is not a valid number.\n"; return EXIT_FAILURE; } if (cday > 6){ cerr << "Sorry, that is not a valid number.\n"; return EXIT_FAILURE; } if (cday < 0){ cerr << "Sorry, that is not a valid number.\n"; return EXIT_FAILURE; } int howmuch {0}; cout << "How many days ahead are you looking ahead?\n"; cin >> howmuch; if (!cin) { cerr << "Sorry, that was not a valid number.\n"; return EXIT_FAILURE; } const int total {(cday + howmuch) % 7}; const int weeks {(cday + howmuch) / 7}; string nday {"days"}; string nweek {"weeks"}; if(total == 1){ nday = "day"; } if(weeks == 1){ nweek = "week"; } cout << "It is " << days[cday] << ".\n" << "In " << howmuch << " " << nday << " it will be a " << days[total] << " " << weeks << " " << nweek << " from now.\n"; return EXIT_SUCCESS; }