Article View: ch.comp.os.linux
Article #19746Re: Off topic, but, VESR Pruefziffer
From: Paul Baer
Date: Sat, 04 Dec 1999 00:00
Date: Sat, 04 Dec 1999 00:00
85 lines
2553 bytes
2553 bytes
Modulo 10 und 11 fuer VESR
Habe das Teil aus einer groesseren Library herauskopiert ist hoffentlich
alles dabei.
-------------------------------
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
static int t[33] = {
4, 3, 2, 7, 6, 5, 4, 3, 2, 7,
6, 5, 4, 3, 2, 7, 6, 5, 4, 3,
2, 7, 6, 5, 4, 3, 2, 7, 6, 5,
4 , 3, 2
};
static int m[10][10] = {
{ 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 },
{ 9, 4, 6, 8, 2, 7, 1, 3, 5, 0 },
{ 4, 6, 8, 2, 7, 1, 3, 5, 0, 9 },
{ 6, 8, 2, 7, 1, 3, 5, 0, 9, 4 },
{ 8, 2, 7, 1, 3, 5, 0, 9, 4, 6 },
{ 2, 7, 1, 3, 5, 0, 9, 4, 6, 8 },
{ 7, 1, 3, 5, 0, 9, 4, 6, 8, 2 },
{ 1, 3, 5, 0, 9, 4, 6, 8, 2, 7 },
{ 3, 5, 0, 9, 4, 6, 8, 2, 7, 1 },
{ 5, 0, 9, 4, 6, 8, 2, 7, 1, 3 }
};
int mod10(s)
char *s;
{
char c, *p;
int u = 0;
p = s;
while (isdigit(*p))
u = m[u][*p++ - '0'];
if (b[u ] == 11) {
return (0);
}else {
return(b[u]);
}
}
int mod11(s)
char *s;
{
char c, *p;
int r = 0;
int i = 0;
p = s;
while (isdigit(*p)) {
r += (t[i++] * (*p++- '0'));
}
r = 11 - (r % 11);
if ( r == 11)
r = 0;
return r;
}
Marc Balmer <marc@msys.ch> schrieb in im Newsbeitrag:
3847FFBC.8C23F040@msys.ch...
> Hallo
>
> Ich habe eine Frage, die zwar etwas off-topic ist...
>
> Weiss jemand, wie die Pruefziffer eines VESR/BESR Einzahlungs-
> scheins (die "blauen") berechnet wird? Die tabellarische Darstellung
> hab ich schon, die sprechen aber von einer "rekursiven modulo 10"
> Berechnung. Ich find den Algorithmus nicht heraus...
>
> Help...
> Marc
>
> --
> /"\ ASCII Ribbon Campaign - Say NO to HTML in email and news
> \ /
> x Marc Balmer, Micro Systems, Kannenfeldstrasse 32, CH-4056 Basel
> / \ Tel. +41 61 383 05 10, Fax 383 05 12, http://www.msys.ch/~marc/
Technical Details
Message-ID:
<7rub28.2ku.ln@lr.cbf.ch>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3847FFBC.8C23F040@msys.ch>Show Full Headers
Complete Article Headers
X-Google-Language: GERMAN,ASCII-7-bit X-Google-Thread: f4b73,df5cdf4096c49e82 X-Google-Attributes: gidf4b73,public From: "Paul Baer" <pbb@cbf.ch> Subject: Re: Off topic, but, VESR Pruefziffer Date: 1999/12/04 Message-ID: <7rub28.2ku.ln@lr.cbf.ch> X-Deja-AN: 556659432 References: <3847FFBC.8C23F040@msys.ch> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: news@ip-plus.net X-Trace: pollux.ip-plus.net 944341802 2679 195.216.80.33 (4 Dec 1999 21:10:02 GMT) Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) X-MSMail-Priority: Normal NNTP-Posting-Date: 4 Dec 1999 21:10:02 GMT Newsgroups: ch.comp.os.linux