一个小小的手机密码系统

 第一次写。

大神不喜勿喷。?(?ω?)?

#include<bits/stdc++.h>
using namespace std;
int main()
{
    char o=0,a[6],b[6]={111,111,111,111,111,111};
    if(b[4]==111)
    {
        cout<<"请设置手机密码"<<endl;
        for(int i=1;i<=6;i++)
        cin>>b[i];
        cout<<"密码设置成功!"<<endl;
    }
    cout<<"  ______________________________________   "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |            请输入手机密码            |  "<<endl;//①这里凹进去是因为里面有中文,复制到编译器里是齐的。详情见下。
    cout<<" |             ······             |  "<<endl;//②
    cout<<" |                                      |  "<<endl;
    cout<<" |   ______       ______       ______   |  "<<endl;
    cout<<" |  |      |     |      |     |      |  |  "<<endl;
    cout<<" |  |   1  |     |   2  |     |   3  |  |  "<<endl;
    cout<<" |  |______|     |______|     |______|  |  "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |   ______       ______       ______   |  "<<endl;
    cout<<" |  |      |     |      |     |      |  |  "<<endl;
    cout<<" |  |   4  |     |   5  |     |   6  |  |  "<<endl;
    cout<<" |  |______|     |______|     |______|  |  "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |   ______       ______       ______   |  "<<endl;
    cout<<" |  |      |     |      |     |      |  |  "<<endl;
    cout<<" |  |   7  |     |   8  |     |   9  |  |  "<<endl;
    cout<<" |  |______|     |______|     |______|  |  "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |                ______                |  "<<endl;
    cout<<" |               |      |               |  "<<endl;
    cout<<" |               |   0  |               |  "<<endl;
    cout<<" |               |______|               |  "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |                                      |  "<<endl;
    cout<<" |______________________________________|  "<<endl;
    for(int j=1;j<=5;j++)
    {  
    o=0;
    for(int i=1;i<=6;i++)
    {
        cout<<endl;
        cin>>a[i];    
        if(b[i]==a[i])
        o++;
    }  
    if(o==6) 
    {
    cout<<"密码正确"<<endl;
    break;
    }    
    else 
    {
        if(j==1||j==2||j==3)
        {
        cout<<"密码错误,请重新输入"<<endl;
        }
        if(j==4)
        {
            cout<<"密码错误,最后一次机会"<<endl;
        }
        if(j==5)
        {
            cout<<"密码错误,手机数据清空"<<endl;    
        } 
    } 
    if(o==6) break;
    }
} 

①中文在编译器中占两个字符位置,而在这里只占一个字符位置,所以会凹进去。

②同上。

注:可以复制

一个小小的手机密码系统

上一篇:移动端点击问题


下一篇:Django框架学习