Bueno este codigo lo que hace es generar una clave de 4 digitos algo asi como la clave de los bancos.
No tengo el ejecutable despues lo subo.
Si alguna duda con el codigo me lo pueden decir para aclararlo.
Program GenClave;
uses crt;
Var CI: longint;
D0,D1,D2,D3,Clave: integer;
Function GenUni(C:longint) : integer;
Var Dmas,Dmenos:integer;
Begin
Dmenos := C mod 10;
repeat
Dmas := C mod 10;
C := C div 10;
until c = 0;
GenUni := (Dmenos+Dmas) mod 10;
End;
Function GenDec(C:longint) : integer;
Var Suma:integer;
Begin
Suma := 0;
repeat
Suma := Suma + C mod 10;
C := C div 10;
until c = 0;
GenDec := Suma mod 9;
End;
Function GenCen(C:longint) : integer;
Var Suma:integer;
Begin
Suma := 0;
repeat
if C mod 10 mod 2 = 0 then
Suma := Suma + C mod 10;
C := C div 10;
until C = 0;
GenCen := Suma mod 7;
End;
Function GenUMi(C:longint) : integer;
Var Prod: longint;
Dmas: integer;
Begin
Prod := 1;
repeat
if C mod 10 <> 0 then
Prod := Prod * (C mod 10);
C := C div 10;
until C = 0;
repeat
Dmas := Prod mod 10;
Prod := Prod div 10;
until Prod = 0;
GenUMi := Dmas;
End;
Begin
clrscr;
write('Introduzca su No. '); read(CI);
D0 := GenUni(CI);
D1 := GenDec(CI);
D2 := GenCen(CI);
D3 := GenUMi(CI);
Clave := D3*1000+D2*100+D1*10+D0;
writeln('Su clave es ',Clave,' Gracias por usar nuestro servicio');
readkey;
end.
Bueno para mas explicacion coloco una imagen:
(http://i49.tinypic.com/ei81dt.jpg)
Es un proceso de suma, resto y division.
Saludos.
ejejeje interesante, no se ven post en pascal, se agradece!
saludos!
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
ejejeje interesante, no se ven post en pascal, se agradece!
saludos!
No hay problema amigo voy a ver si posteo mas de ello.
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
ejejeje interesante, no se ven post en pascal, se agradece!
saludos!
No hay problema amigo voy a ver si posteo mas de ello.
sería genial.
saludos!
Hola loco tengo una duda... es un generador de clave de 4 dígitos pero para q nos puede servir???
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
Hola loco tengo una duda... es un generador de clave de 4 dígitos pero para q nos puede servir???
Para las tarjeta de los bancos. ::)