473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display asterisk when user enters password?

1 New Member
I want to write a code on username and password authentication, but i can't display "*" when entering the password. I am using turbo c++ compiler.
Mar 20 '11 #1
2 36380
horace1
1,510 Recognized Expert Top Contributor
in <conio.h> there is a function getch() which reads the keyboard without echo - you can echo an * yourself
Mar 20 '11 #2
kunwarsingh
1 New Member
Expand|Select|Wrap|Line Numbers
  1. #include<conio.h>
  2. #include<stdio.h>
  3. #include<iostream.h>
  4.  
  5. void main(void)
  6. {
  7.     clrscr();
  8.     char c[10];
  9.     char name;
  10.     cout<<"enter your user name "<<endl;
  11.     cin>>name;
  12.     cout<<"enter your password "<<endl;
  13.     for(int i=0;i<5;i++)
  14.     {
  15.         c[i]=getch();
  16.         printf("*");
  17.     }
  18.  
  19.     cout<<endl;
  20.     cout<<"your password waas"<<endl;
  21.     for(int j=0;j<5;j++)
  22.     {
  23.         cout<<" "<<c[j];
  24.     }
  25. }
i have printed the password also in the last loop that the user has entered just for the verification that it is correct.please remove that last loop it is just to make sure that the correct values are stored in the char array.Here the password length is of 5 characters .But you can change it according to your choice.Ok
Apr 3 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1381
by: Adriaan van Heerden | last post by:
hi, I'm very new to Access and have been searching newsgroups for a few days but can't find exactly what I need. I want to be able to do the following: * user enters patient's hospital number *...
3
1360
by: tdmailbox | last post by:
I have a function that hashs the value that a user entered in a text box and stored that hash value as a password. All is well unless a user enters a password that when hased has a ; in it. If...
4
2679
by: ad | last post by:
I am using MSDE as the database of my program. At the begin of my program, it must display a form for user to enter the password After the user enters the password, I will check the password,...
1
2268
by: tcb | last post by:
I have a RangeValidator setup for two input fields. The validator Type is set to Integer. If the user enters an alpha numeric, the validator works, however, if the user enters a space, the validator...
3
2462
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list...
2
1966
by: s.chelliah | last post by:
We have an input field which allows the user to enter a string of (up to 62) ASCII printable characters. We have a need to allow the user to be able to specify any sequence of characters he/she...
1
1385
by: peter174 | last post by:
How does one go about doing that? I am using C# .NET
2
2284
by: eddy556 | last post by:
Hey, Im having trouble making a textbox change colour when a user enters it. I have managed to textBox2.BackColor = Color.Pink; place that in the code which seems to work but I wish for it to...
2
3214
by: maheshprof | last post by:
hi , how to enable a button when i enter a text in a textbox.and also it should be disabled initially after user types a text in the textbox it should enable
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.