Thread: c++ question
View Single Post
  #2 (permalink)  
Old February 24th, 2004, 03:35 AM
goudvenkat goudvenkat is offline
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check the implementation for yor problem. The length of the UserName and Password are restricted to 10, but you may change it as you wish.

#include <stdio.h>
#include <conio.h>
main()
{
    char UserName[10], Password[10];
    printf("\nEnter User Name :");
    scanf("%s", UserName);
    printf("\nEnter Password :");
    char ch; int i=0;
    while((ch=getch())!=13)
    {
        Password[i] = ch;
        putch('*');
        i++;
    }
    Password[i] = '\0';

    printf("\nThanks\nYour Password is :%s\n", Password);
}

Venkat
Reply With Quote