password masking
Posted by Samath
Last Updated: March 20, 2012
  1153

#include <iostream>
#include <stdio.h>
#include <string>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{

string password = "";
char c = ' ';

while(c != '\r') //Loop until 'Enter' is pressed
         {
         c = getch();
         if(c == '0')
            {
            switch(getch())
               {
               default:
                  break;            
               };
            }
         else if(c == '\b')   
//If the 'Backspace' key is pressed
            {
            if(password.size() != 0)  
//If the password string contains data, erase last character
               {
               cout << "\b \b";
               password.erase(password.size() - 1, 1);
               }
            continue;
            }
         else if(c <= '9' && c >= '0' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')  
//If user enters 1-9, a-z, or A-Z, add it to the password and display an asterisk
            {
            password += c;
            cout << "*";
            }
         else
            continue;
         }
    return 0;
}


         
         
     
   
  
 
 
   

 
 
use clear screen to hide the characters...
 
nice blog.but how bout you show us one for masking ip addreses
 
ok kool.. stay tuned to my blogs! masking ip address next!!! lol
 
Nicely done