password and username program

조회 수: 9 (최근 30일)
cameron vandebrake
cameron vandebrake 2015년 10월 29일
답변: Chad Greene 2015년 10월 29일
This is what i need to write for my script and i cant seem to even get started, maybe some one can give me an out line on how to get started of something. that would be great thanks.
"Write a program that error checks user input. The user will enter a username, a password and a number, your program will check to make sure the information entered is valid and display a message telling the user. Use the user name in the prompt to get the number. The criteria are as follows: Username Must be at least 6 characters long Must begin with a letter Can have letters and numbers but no special characters Password Must be at least 8 characters Must have at least one capital letter and one number Is case sensitive Verify by having user type it twice and check to see if it matches Number Must be a valid number that could be used in a calculation Cannot have letters or special characters"

답변 (1개)

Chad Greene
Chad Greene 2015년 10월 29일
I'd start with inputdlg. The first example in the documentation shows how to make the user enter two inputs. You'll have to modify it to make sure the user enters three inputs.
For error checks, I'd use isnumeric(number) to verify that the number is a number. You can do ~isnumeric(username) to verify that the username is not a number. And I'd use regexp to verify that special characters are present in the password.
Good luck!

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by