1501: 6位密码输入检测
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:3906
Solved:3417
Description
从键盘输入6位仅由数字0~9组成的密码。用户每输入一个密码并按回车键后,程序给出判断:如果是数字,则原样输出该数字,并提示用户目前已经输入了几位密码,同时继续输入下一位密码;否则,程序提示"error",并让用户继续输入下一位密码。直到用户输入的密码全部是数字为止。
以下为程序的运行结果示例:
Input your password:
1↙
1, you have enter 1-bits number
6↙
6, you have enter 2-bits number
a↙
error
d↙
error
4↙
4, you have enter 3-bits number
6↙
6, you have enter 4-bits number
8↙
8, you have enter 5-bits number
2↙
2, you have enter 6-bits number
Input
数字字符输入格式:"%c"
Output
输入提示信息:"Input your password:\n"
如果输入的是数字,输出格式为:"%c, you have enter %d-bits number\n"
如果输入的不是数字,输出提示信息:"error\n"
为避免出现格式错误,请直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。
Sample Input Copy
1
6
a
d
4
6
8
2
Sample Output Copy
Input your password:
1, you have enter 1-bits number
6, you have enter 2-bits number
error
error
4, you have enter 3-bits number
6, you have enter 4-bits number
8, you have enter 5-bits number
2, you have enter 6-bits number