// Friday13.cpp (c) Kari Laitinen // http://www.naturalprogramming.com/ // 1997-10-20 File created. // 2013-11-12 Last modification. #include using namespace std ; #include "class_date.h" int main() { char given_date_as_string[ 20 ] ; cout <<"\n This program can print you a list of 10 dates" "\n that are Fridays and 13th days of a month." "\n Please, type in a date from which you want" "\n the calculation to begin. Type in the date either" "\n in form DD.MM.YYYY or in form MM/DD/YYYY and use" "\n two digits for days and months and four digits" "\n for the year: " ; cin >> given_date_as_string ; Date date_to_increment( given_date_as_string ) ; int number_of_friday13_dates_to_print = 10 ; cout << "\n It is a common belief that you may have" "\n bad luck on the following dates:\n" ; while ( number_of_friday13_dates_to_print > 0 ) { while ( date_to_increment.index_for_day_of_week() != 4 || date_to_increment.day() != 13 ) { date_to_increment.increment() ; } cout << "\n " << date_to_increment << ", " ; date_to_increment.print_day_of_week( cout ) ; date_to_increment.increment() ; number_of_friday13_dates_to_print -- ; } }