Help for a code? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help for a code?

Panasonic99Panasonic99 Posts: 140Member
with option strict and option explicit on,

Creat an application that allows the user to enter a password that contains, five, six, or seven characters. The application then should create a new password as follows:

Replace all vowels with the letter X.
Replace all number with the letter Z.
Reverse the characters in the password.
For instance, ABC1DEF -> FXDZCBX


Comments

  • kanchikannankanchikannan Posts: 7Member
    : with option strict and option explicit on,
    :
    : Creat an application that allows the user to enter a password that contains, five, six, or seven characters. The application then should create a new password as follows:
    :
    : Replace all vowels with the letter X.
    : Replace all number with the letter Z.
    : Reverse the characters in the password.
    : For instance, ABC1DEF -> FXDZCBX
    :
    :
    :

    Hai,

    The solution is...

    Dim oldpwd As String
    Dim newpwd As String
    Dim ir As Integer

    oldpwd = "ABC1DEF"
    newpwd = ""
    For ir = 1 To Len(oldpwd)
    If InStr("AEIOU", Mid(oldpwd, ir, 1)) Then
    newpwd = "X" + newpwd
    ElseIf InStr("0123456789", Mid(oldpwd, ir, 1)) Then
    newpwd = "Z" + newpwd
    Else
    newpwd = Mid(oldpwd, ir, 1) + newpwd
    End If
    Next
    MsgBox(newpwd)

    With Love,
    Kannan

Sign In or Register to comment.