road420

导航

<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

统计

常用链接

留言簿(2)

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜

密码输入匹配问题

 

#include < iostream.h >
#include
< conio.h >
#include
< stdio.h >
#include
< string .h >

int  main()
{
 
char  name[ 20 ]; 
 cout
<< " your name: " << endl;
 gets(name);
 cout
<< " your password: " << endl;
 
char  password[ 20 ];
 
char  s[ 20 ] = { ' 8 ' , ' 5 ' , ' 4 ' , ' 2 ' } ;
 
int  i = 0 ;
 
while ( 1 )
    
{    
        password[i]
= getch();
        cout
<< ' * ' << flush;
        
if (password[i] == 13 || i > 8 )
         

           password[i]
= ' \0 ' ;
           cout
<< " \n " ;
           
break ;
         }
  
        i
++ ;
    }

 
if ((strcmp(s,password)) == 0 )
     cout
<< " 密码正确 " << endl;
 
else
     cout
<< " 密码错误 " << endl;
  
 
return   0 ;
}
 

posted on 2006-05-09 22:06 深邃者 阅读(231) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理