您的位置:首页 > 编程语言 > C语言/C++

具有密码输入隐藏功能(c语言编)

2012-07-30 08:48 821 查看
/*这个例子很简单的就把密码输入隐藏功能呈现出来,关键的一点就是system(“cls”),与大家分享*/

#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

void main()

{

int ch,i;

int count=0;

char passwd[128];

while((ch=getch())!=13)

{

if(ch==8)

{

system("cls");

for(i=(--count);i>0;i--)

printf("*");

passwd[count]=' ';

}

else

{

printf("*");

passwd[count++]=ch;

}

}

passwd[count]='\0' ;

printf("\nThe password you have inputed is : %s\n",passwd);

getch();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: