/ Published in: C++
In C++ console there's no way to make our passwords invisible when typing them. Here is a really simple funcion that resembles the behavior of hiding passwords.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <iostream> #include <string> using namespace std; void askForSecretPassword(void){ string password; cout<<"Enter your password: "; cin>>password; int len=password.length(); system("cls"); cout<<"Enter numeric password: "; for(int i=0;i<len;i++){ cout<<"*"; }cout<<endl; }; void main(){ askForSecretPassword(); system("pause"); }
URL: http://programmingeiger824.blogspot.com