Create a Password Calculator

Asked

Viewed 114 times

-1

First I am beginner in Delphi and I took as my primary initiative to carry out a program to assist in my work, because in the application I use the password varies daily in two situations that I will say to follow:

The calculation of the first password is simple, basically: (dia x mês) + 2012

The calculation of the second password is: ((dia x mês) + 2013) + dia

Obs: remembering that I will only use a button to generate the first password and one for the second

I would like a help on how I can perform these calculations in Delphi 7, because watching some videos of creating calculator you could even locate in the application, but not to perform... to whom can help...

1 answer

2


You can perform simple math calculation for this, what you need is to decode the current date to extract the required data.

In the System.DateUtils there is a function for this.

Ex to the first calculation:

var
  vDia: Word;
  vMes: Word;
  vAno: Word;
  vSenha: string;
begin
  // Dia, mês e ano separado
  DecodeDate(Now, vAno, vMes, vDia);

  // Cálculo simples
  vSenha := IntToStr((vDia * vMes) + 2012);
end;
  • that’s exactly what I was looking for, a simple way to understand how it would work in calculus... I really appreciate the help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.