This program allows users to input a range of dates and determine which dates within that range are prime when formatted as YYYY-MM-DD
.
- A C++ compiler that supports C++11 or higher (e.g., GCC, Clang, or MSVC).
- The
PrimeUtils.h
file which contains the utility functions.
- Compile the source code.
- Run the program.
- When prompted, enter the start and end dates in the
YYYY-MM-DD
format. - The program will then display any prime dates within the specified range.
- To exit the program, simply enter
quit
orq
or just an empty string
- Robust input error handling: The program will catch and inform you of any input format errors.
- Efficient prime checking algorithm.
The program prompts the user for a start and end date, then iterates through each date in that range. It then checks whether the date, when formatted as YYYY-MM-DD
, is a prime number. If it is, it displays the date and the corresponding number to the user.
- Leap years are accounted for, but there may be discrepancies in very distant future years.
- The program assumes the Gregorian calendar.