#include<stdio.h>
#include<conio.h>
#define max 20void input_password(char *password)
{int i=0;char c;printf("请输入您的密码(取前20位):\n");while((c=getch())!='\r'){if(c!='\b'){password[i++] = c;printf("*");}else{if(i>0){putchar('\b');putchar(' ');putchar('\b');i--;}} }password[i] = '\0';return ;
}int main()
{char password[max+1];char *p = password;input_password(p);return 0;
}