password in star form
-
i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }
-
i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }
-
i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }
You could try putting
_getch()
in a loop, printing a '*' for each character typed."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }
Unfortunately there is no way in standard C/C++ to do that, but I see you're already using non-standard functions anyway. As David pointed out,
_getch()
should do the trick:#include "stdio.h"
#include "conio.h"int main()
{
char c;
c = _getch();
putchar('*');
printf("\nYou entered %c\n", c);
_getch(); // just to pause the program before closing the output console
return 0;
}If this doesn't work, refer to this thread for more advice: c++ - Capture characters from standard input without waiting for enter to be pressed - Stack Overflow[^]
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)