百度空间 | 百度首页 
 
查看文章
 
密码检测
2009-02-21 20:28
#include<iostream>
#include<stdlib.h>
using namespace std;
bool password();
int main(){
do{}
while(password()!=true);
cout<<"welcome to system!"<<endl;
return 0;
}
bool password(){
   static numofrun=0;
   if(numofrun<3){
   int psw;
   cout<<"第"<<++numofrun<<"次输入密码"<<endl;
   cin>>psw;
   if(psw==123456){
   return true;
   }else{
   cout<<"password error!"<<endl;
   return false ;
   }
   }
   else {
   cout<<"您已经输错密码三次!异常退出!"<<endl;
   exit(0);
   }
   }
  

类别:Coding | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
本篇日志被作者设置为禁止发表新评论

     

©2009 Baidu