Do not get confused by the title of the Article. I am here to give you a simple program that would take the Input from you, Then, what is the big deal here ? The point is that you are not allowed to print anything of the input on the Input Window, I mean you can diplay an *, a # or a @, but you can’t show the entered Password String.

Ok, It is a bit confusing, let me tell you, suppose you enter something like “Computer”. In C, the input is not sent to Processor until you press Enter Key on your mighty Key Board, until then, All the input characters on the wisible on the Run Screen. So, Now the task is simpler, you are REQUIRED to accept the input on the Run Window but you are not allowed to display the entered characters on the Run Window before the user hits Enter. So, lets see, how it can be done ?

If you have some prograaming on TCC (Turbo C++) compiler, I am sure that you must have used getch() command. At that time, you are told that this function would hold  your Run Window until you press Enter and since, you can not exit the Run Window until you press the Enter key, you are able to see what you have done with your prograaming.

Actully, the fact is somewhat different, getch() does not works as we think it does, it is one of the input functions available to the C Programmer. It is a single special Input type pre defined function that takes input but does not displays anything on the Screen. So, the task is more simpler now. But this also leads to another confusion, if it is so, then why it helps in Stopping the Otput window. The reason in more simple. It takes an input and returns the chatacer, so, the program”s last instruction is to take an imput from the user and then exiting the program. You can see its syntax in the Help Section available in TC++.

I am probiding you the program, how I did it.

# include<conio.h>
# include<stdio.h>

int main()
{
    char a[20];
    int i,j;

    for(i=0;i<20;i++)
    {
        a[i]=getch();
        if(a[i]==13)
            break;
        else
            printf("*");
    }

    printf("\n");

    for(j=0;j<i;j++)
        printf("%c",a[j]);

    return 0;
}

The program is quite simpler, However, I have left something here. If you make a typo, this program would not correct it, you displayed passowrd would be entirely differebt than you wanted to enter. The reason is that I have not included any special action to be taken if it encounters a backspace key. However, I have mentioned the action to be taken if it encounters Enter Key. I have not included that section here, you can do it by yourself by little knowledge of ASCII, array and LOGIC. If you fail to do that,just  ping me here by commenting here, I will mail you the complete program.

Good Luck, 🙂