I recently shifted from Turbo C++(DOS BOX) to visual studio code. In Turbo C++, I used to create a star-password program like:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char name[20],a[20];
cout<<"Enter username: ";
gets(name);
cout<<"Enter password: ";
a[0]=getch();
cout<<"*";
int i=0;
while(ch[i]!=13) //to come out of loop when
//enter key is pressed.
{
++i;
ch[i]=getch(); //no need to hit enter
//after entering each character
cout<<"*";
}
cout<<"Password created successfully!";
But as you know, the C++11 is a bit different, I can't use getch() there. I didn't get any other function except getch() in which there is no need to press enter key after each character input. Is there any alternate or any other way to do it?