DataMuseum.dkPresents historical artifacts from the history of: CR80 Hard and Floppy Disks |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CR80 Hard and Floppy Disks Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 1368 (0x558) Types: TextFile Names: »CPR.S«
└─⟦b21be6f3b⟧ Bits:30005082 8" CR80 Floppy CR80FD_0036 ( CR/D/3143 KLP & KMO C-KURSUS + C JOBFILER 861127 Volume MOVEFL RAM TEST css/709 #0000-7fff V24+SCM ) └─⟦95f1eafb2⟧ └─ ⟦this⟧ »GR1.D!CPR.D!CPR.S« └─⟦c25823ad8⟧ Bits:30005089 8" CR80 Floppy CR80FD_0044 ( @*FLOPPY C ) └─⟦feb1d529a⟧ └─ ⟦this⟧ »GR1.D!CPR.D!CPR.S«
#include <std.h> main () { BOOL ok; char cpr [10]; readcpr (cpr, ok); if (ok) /* cpr no numeric */ { checkcpr (cpr, ok); /* check date, month, year */ if (ok) /* cpr no valid */ { modcpr (cpr, ok); if (ok) putfmt ("CPR number okey-dokey\n"); else putfmt ("CPR number NOT ok\n"); } /* end brace */ } /* end grace */ return (1); } /* space */ /* internal PROCEDURES */ readcpr (cpr, ok) char cpr [10]; BOOL ok; { int count = 0; putfmt ("Enter cpr number\n"); while (count++ < 10) { cpr [count] = getch(); ok = isdigit (cpr [count]); if (!ok) break; } if (!ok) putfmt ("Invalid digit in number\n"); } checkcpr (cpr, ok) char cpr [10]; BOOL ok; { /* chec«fs»k day format yymmddnnnn */ int index = 0; ok = !(cpr [index] > "3"); if (ok) if (cpr [index++] == "3") ok = !(cpr [index++] > "1"); if (ok) /* check month */ { ok = !(cpr [index] > "1"); if (ok) if (cpr [index++] == "1") ok = !(cpr [index] > "2"); } if (!ok) putfmt ("Invalid birthday in number\n"); } modcpr (cpr, ok) char *cpr; BOOL ok; { static int check [10] = {4,3,2,7,6,5,4,3,2,1}; int sum, count; for (sum = 0, count = 0; count < 10; sum += (check [count] * (cpr[count] - '0')), count++); ok = !(sum % 11); } «a5»