C++ Program to change the password input to **** while Entering

//admin is the password for secured login you can also customize the password in adminlogin function

 #include<iostream>

#include<string.h>

#include<iomanip>

#include<conio.h>

#include<stdlib.h>

using namespace std;

void line()

{

cout<<"======================================\n";

}

void adminlogin()

{


int flag=0;

START:

    system("cls");

    line();

cout<<"\t\tSECURED LOGIN!\n";

line();

    cout<<"\nEnter Password  : ";

    char pass[32],pwd[32]={"admin"};//you can change the password from here this is the password for now...

    int i=0;

    char a;

    for(i=0;;)

{

        a=getch();

        if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9'))

        {

            pass[i]=a;

            ++i;

            cout<<"*";

        }

        if(a=='\b'&&i>=1) 

        {

            cout<<"\b \b";

            --i;

        }

        if(a==13)

        {

            pass[i]='\0';

            break;

        }

    }

    if(strcmp(pass,pwd)==0)

    {

   

    cout<<"\nPassword Matches...";

}

else

{

cout<<"\nPassword Soes Not Matches...\n";

}


}

int main()

{

adminlogin();

}

Comments

Popular posts from this blog