Ive been working on a program that can mask the password and has 3 attempts.
so far i can't do both at the same time.
here is my work.
any idea how can i do both?
The problem is that after 1 try when user presses enter 13 gets stored in input and the next time it does not go into the while.
So just put input = 0; before the while loop or just change the condition in the while to always true like while(true) or while(1), i think that should work.
So to me it looks like you're trying to get a character and then quickly clear the screen.
Personally I'd probably just turn the color to the command prompt off (so it's black text on black).
Oh if you're afraid of highlighting revealing the text, then I'd look for a way to block input going into the console and gather my letters via some other root, and output a * ever time this is successful.
1 2
GetKeyState(int key);
GetAsyncKeyState(int key);
These may be able to help with getting keys via "the other root", however some work is needed because you have to find shift and space etc yourself...
I'm sure there's other things, if you can't figure out a way around a problem, maybe you're looking at the wrong problem? (hope that helps in future)