69. Generating social security numbers

Write a program that can generate social security numbers for two countries, Northeria and Southeria, that have different but similar formats for the numbers:

  • In Northeria, the numbers have the format SYYYYMMDDNNNNNC, where S is a digit representing the sex, 9 for females and 7 for males, YYYYMMDD is the birth date, NNNNN is a five-digit random number, unique for a day (meaning that the same number can appear twice for two different dates, but not the same date), and C is a digit picked so that the checksum computed as described later is a multiple of 11.
  • In Southeria, the numbers have the format SYYYYMMDDNNNNC, where S is a digit representing the sex, 1 for females and 2 for males, YYYYMMDD is the ...

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.