Compiler-Code::Blocks Operating System(OS)-Windows
I wrote a very simple password masking program unlike the complicated ones on the internet.When i build and run my code it displays "Enter password" but does not allow me to input anything.
By password masking i mean that when i enter password then it is displayed as **** while being input just as it happens in E-mail.(one * for each character)
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main()
{
string pass;
cout << "Enter password";
for (int i=0; i<100; i++)
{
char ch = getch();
if (ch == 13)
break;
if (ch == 8)
{
if (pass.size())
{
cout << "\b \b";
pass.pop_back();
}
}
else
{
cout << "*";
pass += ch;
}
}
cout << "pass = " << pass << '\n';
}
Duh. I found the simplest solution ever. settings>compiler>reset defaults :|