I need to write a program that asks a user for their new password, to check that they have entered it correctly they must verify it by entering it again. If the two passwords matach then you accept the change and tell the user that they have been successful on the first attempt and you print out the new password.

If they make a mistake entering the second password, the program tells them their password has not been changed and the program starts again. When they finally get it correct, the program tells them they have been successful and how many attepts it took them.

Please help me again.

{
I need to write a program that asks a user
for their new password, to check that they have entered
it correctly they must verify it by entering it again.
If the two passwords matach then you accept the change
and tell the user that they have been successful on the first
attempt and you print out the new password.
If they make a mistake entering the second password,
the program tells them their password has not been changed
and the program starts again. When they finally get it correct,
the program tells them they have been successful
and how many attepts it took them.
}

Program Program01;

Uses Crt;

Var Password,NewPassword,VerifyPassword:String;
    Counter:Integer;
    Result:Boolean;{true or false}
Begin {main}
     Counter:=0;
     Password:='123-Fla-ming-Claw-456';{just example}
     Result:=False;{why?}
     Repeat
        Write('Give me the new password: ');
        ReadLn(NewPassword);
        ClrScr;{clears the screen,part of Crt unit}
        Write('Repeat the new password: ');
        ReadLn(VerifyPassword);
        If (NewPassword <> VerifyPassword) Then
           Begin
              WriteLn('Error while verifying the  password!Try Again!');
              WriteLn('Your password is: ',Password);
              {'result' stays 'False'}
           End
        Else
           Begin
              Password:=NewPassword;  {changes values}
              Result:= True;       {got it?}
           End;
        Counter:=Counter+1;{add 1 each round}
     Until Result = True; {analizing here}
     WriteLn;
     WriteLn('New password accepted!!');
     WriteLn('Your new password is : ',Password);
     WriteLn('Total Trying: ',Counter);
     ReadLn;
End.

{
-= Note By FlamingClaw =-

All programs created by me are written and tested
in Dev Pascal and/or Turbo Pascal 7.0

-= Created By FlamingClaw =-
-=2009.03.26=-
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.