In this article I will discuss the how to protect any program from password and how password is work. By this article you can learn about the password function and it’s working. I also provide the c or c++ programm and it’s output so you can more undertand about the password function to any application of c or c++ program or project.
At first learn about the what is need of password protection to any application. The password protection is needed to application because of the some application is designed for specific user so that by password protection we can ensure that the authorized user is access the application.
To protect c or c++ application mans use password is done by using the password function which is given in this article.
The password is the string which is not shown in window when the password is entered means that the only * is shown in window when the password is entered by user.
And the password may be any special symbol or back sapce also so that the we can not use the “scanf “ or “cin” function of programming language. And also the after “enter” key is pressed the password is end.
So we use the “getch” function because of the “getch” fucntion return the ascii value of pressed key.
That is we can store the ascii value of entered key in any array from getch function and use for comparession.
Here a very simple program for password function. In this program the standard password is ‘1234567’ this may be stored in file by using the file handling in this program. In this program you only have three chance. Means that the if you enter worng password then only three time after three time worng entry program is exit.
Password function example