Making Real password

hi, Any body please let me know are there any ways to take the password in '******'(asterisk key) is it possible

please let me know soon. This is for my college project
Brother, i am tried with these codes. But it works. But the issue is when i pressed the backspace key on my keboard it also taken as a password input. Does any one can fix this??





#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main(){
string pass ="";
char ch;
cout << "Enter pass\n";
ch = _getch();
while(ch != 13){//character 13 is enter
pass.push_back(ch);
cout << '*';
ch = _getch();
}
if(pass == "Mitsakos"){
cout << "\nAccess granted :P\n";
}else{
cout << "\nAccess aborted...\n";
}
}
Your problem is you're adding the backspace character, '\b', to the password string. In addition to your check for the enter key (which should be rewritten (ch != '\r'), so you wouldn't need the comment about it), you should check if they enter '\b' then pull the next most recent char out manually.

http://www.cplusplus.com/doc/tutorial/constants/

Also ''real'' passwords should probably use encryption.
Topic archived. No new replies allowed.