how to use * to appear as password character in c++

hello guys.. i hope you can help me for this codes..
im trying to make a program that will accept username and password in c++.
im using turbo c++ ide 3.0
"not dev c++".

here is my code..
but the problem is.., i want to use * to appear as password character in my codes.
but everytime i press enter key, the program consider it as *.
so i need to press enter key again to proceed to the program yet it will generate error because
the first time i pressed enter was consider as part of the password.

I hope that you are aware that you are learning to use an antiquated pre-standard variant of C++ by relying on such an ancient compiler, right? Turbo C++ 3.0 came out in 1991, and the first standard for C++ came out in 1998. Turbo C++ is literally a pre-historic compiler. Are you aware that much of what you are learning by using this compiler will have to be unlearned before you can start to program in the real world? The language and practices have evolved significantly since then, including 2 standards (in 1998 and 2011), 2 revisions to the standards (2003 and 2014), and a few technical reports / specifications (2007, 2010, 2014, and more to come). Not to mention that most people consider the real birth of C++ to be around the 2001-2003 years when real modern practices were established. You are basically learning to knock stones together to make fire, while most people are driving Formula 1 cars.

Of course, your code is riddled with non-standard stuff (and you need to learn to indent your code correctly). But if you have to persist with a pre-historic compiler, then there isn't much I can do about that. If this is required for a course (then they should update their curriculums!!), then you'll have to suffer this, but if you seriously want to learn C++, you'll have to learn modern standard C++ in addition to learning the pre-historic language that your course is teaching you.

thank you so much for your advice... it will help a lot specially in developing my skills.. i just want to learn even the prehistoric programming language to advance.. for me to understand a lot of codes and how it works.. again thank you so much .. =)

but still the codes you provided won't work. the only problem here is the enter key was considered as * and acccept as part of the password. it needs tp press enter key two times to proceed through the programs.

Since you're working with raw keyboard data, there's more work to be done than simply calling getch and printing the mask character. You need to recognize a line feed starter as well as any backspacing. Off the top of my head, something like this: