Hiding Passwords With C++


/ Published in: C++
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5. void askForSecretPassword(void){
  6. string password;
  7. cout<<"Enter your password: ";
  8. cin>>password;
  9. int len=password.length();
  10. system("cls");
  11. cout<<"Enter numeric password: ";
  12. for(int i=0;i<len;i++){
  13. cout<<"*";
  14. }cout<<endl;
  15. };
  16. void main(){
  17.  
  18. askForSecretPassword();
  19. system("pause");
  20.  
  21. }

URL: http://programmingeiger824.blogspot.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.