Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Password * in C++, pls help


ghost's Avatar
0 0

Hello, i want to, when i type in a password or something with cin or getline(cin, something) to display *'s, Please Help!


ghost's Avatar
0 0

how its done in C:


#define BUFFER_SIZE 1024

int main(int argc, char **argv)
{
   char c, pass[BUFFER_SIZE];
   int i = 0;
   while(((c = getch()) != 13) && i < BUFFER_SIZE)
   {
      *(pass + i++) = c;
      printf("*");
   }
   *(pass + i) = '\0';
   return 0;
}```

im sure its quite similar in c++