Saturday, July 14, 2012

0

C++ program for password

  • Saturday, July 14, 2012
  • vinod
  • Share


  • The cpp is an object oriented language. In c++we can create classes,objects by using this features we can create program easily.C++ is one of the most popular programming languages.The c++ has different features such as data abstraction,polymorphism,inheritance,encapsulation you can learn c++ by online tutorials like lynda.com or any other online tutorial you can also buy written by bjarne stroustrup or any other famous author
    C++ inherits most of the c syntax.It has more features than c if you learn both of this languages you can understand more.Now let we show you c++ program.You have to type the two header files.Click here to download the c++ application


    Source code:
    
    
    #include
    #include
    void main()
    {
    clrscr();
    cout<<"Enter the password: \n";
    restart:int x[100],x1[100],i,j=0,k=0,l;
    for(i=0;i<=100;i++){
    shahab:l=getch();
    if(((l>=48)&&(l<=126))||(l==8)||(l==13))x[i]=l;
    else goto shahab;
    if(x[i]==13)break;
    else if(x[i]==8)
    {
    gotoxy(1,2);
    clreol();
    for(i=0;i<100;i++)
    x[i]='\0';
    goto restart;
    }
    else
    {
    cout<<"*";
    k++;
    }
    }
    cout<<"\n Re-enter password: \n";
    for(i=0;i<=k;i++)
    {
    x1[i]=getche();
    if(x1[i]==13)break;
    }
    for(i=0;i<=k;i++)
    if(x[i]!=x1[i])j++; if(j==0)
    cout<<"\n Password matching\n";
    else
    cout<<"\n Password do not match!!\n";
    getch();
    }

    Output

    Enter the password:
    **********
    Re enter password:
    9876543210
    Password match

    Enter password:
    **********
    Re-enter password:
    98765432
    Password do not match









    Post a Comment

    Followers

    Subscribe