c++怎么实习输入密码。如果密码正确则printf字符串
c++怎么实习输入密码。如果密码正确则printf 字符串
以下是我写的参考(输入密码时只能看到*)
#include <cstdio>
#include <cstring>
#include <conio.h>
void inputpassword(char pass[])
{
int i=0;
char ch;
while(1)
{
ch=getch();
if(ch!='
')
{
if(ch!=''){
pass[i]=ch;
i++;
printf("*");
}else{
if(i>0){
i--;
printf(" ");
}
}
}else{
break;
}
}
pass[i]='