How to create a password program

15 views (last 30 days)
Mike
Mike on 12 Sep 2012
Hello there guys...
Please help me to create a program that will accept a user and a password. the Algo will be like this. >>>>>Run the program
>>prompt
>>Username: %the user will type the username say for example admin
>>password: %the user will type the password for example still "admin".. BUT. the password should be in "asterisk" for protection purposes!..
i cant figure if what im going to do in this part. help me guys.. ^_^'

Accepted Answer

Matt Fig
Matt Fig on 12 Sep 2012
GUI_37 gives a demo of this.
  2 Comments
Mike
Mike on 12 Sep 2012
OK sir.. ill work on it..
thanks! ^_^
Mike
Mike on 12 Sep 2012
on my current level.. its hard for me to understand some of the syntax you used on the program. but the comment help me a little....
im doing it w/o GUI.. my only problem is to type the password w/o showing the word but "*" only..
heres my code:
clc
userdef='admin';
passdef='admin';
userin=input(' Username: ','s');
passin=input(' Password: ','s');
a=length(userin); a1=length(userdef);
b=length(passin); b1=length(passdef);
if(a==a1 & b==b1)
if(userin==userdef & passin==passdef)
fprintf(' Correct!');
else
fprintf(' Wrong!');
end
else
fprintf(' Wrong!');
end
%actually.. this just a piece of program. im going to apply this on our project

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!