I need help to make this C++ password function more secure and better | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help to make this C++ password function more secure and better

const int password = 4321; void security(int pwd) { cout<<"Enter password: "; cin>>pwd; if(pwd!=password) { cout<<"WRONG PASSWORD\n"; exit(0); } }

12th May 2017, 8:04 PM
Eric Odhiambo
Eric Odhiambo - avatar
2 Answers
+ 3
ask characters using getch() which doesnt display entered character on to screen. everytime u recieve one character, print a *, if user presses back key, print '\b', backspace character.
13th May 2017, 2:17 AM
P Sandesh Baliga
P Sandesh Baliga - avatar
+ 2
you could make it in a loop and stop the program if someone tries to enter a wrong password more than 3 times
12th May 2017, 8:07 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar