Password

How to type password like "******" in program ???

e.g.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    char a[80],b[80];
    char d[]="Hasak";
    char e[]="nimukaet";
    int c=1;
    a:cout<<"Username: "; cin>>a;
    cout<<"Password: "; cin>>b;
    if(strcmp(a,d)==0 && strcmp(b,e)==0)
    {
                  cout<<"Welcome!"<<endl;
    }
    else
    {
        if(c>=3)
        {
                cout<<"You enter wrong username or password 3 times!"<<endl;
                system("pause");
                return 0;
        }
        cout<<"Wrong username or password!"<<endl<<"Try again"<<endl<<endl;
        c++;
        goto a;
    }
    system("pause");
    return 0;
}


when its cin>>b; then to show **** instead of letters.
You need to deactivate `echo'
Then use unbuffered reading (as an alternative, use buffered input and don't give any feedback)

Put everything as it was when you end.
how to do that ?
1_ Use a library like `ncurses'
A_ Use your API
Topic archived. No new replies allowed.